delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/18/09:46:25

From: ams AT ludd DOT luth DOT se (Martin Str|mberg)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Strange behaviour
Date: 18 Mar 1999 04:50:30 GMT
Organization: University of Lulea, Sweden
Lines: 33
Message-ID: <7cq0mm$q5$1@news.luth.se>
References: <36ee7e34 DOT 0 AT nnrp1 DOT news DOT uk DOT psi DOT net> <7cm9u1$f69$3 AT news DOT luth DOT se> <36efb934 DOT 243847701 AT news DOT snafu DOT de>
NNTP-Posting-Host: queeg.ludd.luth.se
X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019