|
From: Vincent T. <vt...@un...> - 2010-06-29 05:48:50
|
Hey according to msdn : http://msdn.microsoft.com/en-us/library/xdb9w69d%28VS.71%29.aspx to get an unsigned char, i should use "%hc" as modifier (i think that "Single-byte" means unsigned char, as "%c" is for char (being signed or unsigned)) But if I compile this program (with gcc 4.5.0) : [code] #include <stdio.h> int main() { char buf[32]; unsigned char uc; /* fill buf here */ sscanf(buf, "%hc", &uc); return 0; } [/code] then gcc reports that format "%hc" expects type 'short int *' but argument 3 has type 'unsigned char *' According to the same link above, for short in, it's 'h' with 'd', 'i', 'o', 'x', or 'X' Am I doing something wrong or is there a bug in header files ? thank you Vincent Torri |