Using 'hhx' conversion in sscanf in c99 mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the following program, test_scanf_hex.c

#include <stdio.h>

int main()
    {

    const char * str = "0xa4";
    unsigned char res = 0;

    sscanf(str,"%hhx",&res);

    return (res == 0 ? 1 : 0);
    }

If I compile with -std=c99 I receive:

test_scanf_hex.c: In function 'main':
test_scanf_hex.c:9:19: warning: unknown conversion type character 'h' in format [-Wformat=]
     sscanf(str,"%hhx",&res);
                   ^
test_scanf_hex.c:9:16: warning: too many arguments for format [-Wformat-extra-args]
     sscanf(str,"%hhx",&res);
                ^~~~~~
test_scanf_hex.c:9:19: warning: unknown conversion type character 'h' in format [-Wformat=]
     sscanf(str,"%hhx",&res);
                   ^
test_scanf_hex.c:9:16: warning: too many arguments for format [-Wformat-extra-args]
     sscanf(str,"%hhx",&res);
                ^~~~~~

Why is the 'hh' modifier not supported in c99 ?






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux