scanf %x allows leading 0x?!?

Stephen Clamage steve at taumet.com
Sun May 12 05:36:26 AEST 1991


scjones at thor.sdrc.com (Larry Jones) writes:

|I was just surprised to discover that the %x conversion specifier
|used in the *scanf functions allows the target string to have a
|leading 0x or 0X.  I don't remember any discussion about it and a
|few quick tests show about a 50/50 split of systems that allow it
|and systems that don't.  Was that behavior specified in the SVID
|or /usr/group specs, was it picked up from somewhere else, or is
|it just an unaticipated feature?

It is the explicitly-specified behavior in ANSI C.  On systems which
do not follow the ANSI standard, you may get different behavior.
-- 

Steve Clamage, TauMetric Corp, steve at taumet.com



More information about the Comp.std.c mailing list