Mail Archives: djgpp/1999/03/18/09:46:25
Horst Kraemer (horst DOT kraemer AT snafu DOT de) wrote:
: On 16 Mar 1999 19:03:29 GMT, ams AT ludd DOT luth DOT se (Martin Str|mberg)
: wrote:
:
: > : Whenever I run the program, the 'result' file is always empty. However, the
: > : same program runs fine when compiled and run from MSVC. Any ideas? Thanks.
: > : Ya'qub
: >
: > It seems you have found a bug in MSVC.
: > Try "while (fscanf(infid," 0x%hX",&val) == 1)".
: >
: > I havn't tried it but according to my C reference book %x and possibly
: > %X reads a base 16 number; not 0x followed by a base 16 number.
:
: The C Standard specifies that a hex digit sequence may be optionally
: preceded by 0X of 0x as input to strtoul(16) or *scanf("%x").
You're right. I didn't read long enough. In the end it says exactly
that (as a special case, when base is 16, the number may be prefixed
with "0x" or "0X"). Sorry Microsnoft.
: And it only mentions %x and not %X as input specifiers for *scanf. %X
: is an output specifier for *printf. I assume that this won't be the
: problem - but thou shalt not assume anything ;-)
My book @cite{Harbison and Steele jr, C, a Reference Manual} says
"Some non-ISO C implementations accept the letter X as an equivalent
conversion operation."
Stina Nordenstam, Memories of a Color,
MartinS
- Raw text -