Explain this sscanf behavior.
Arne Henrik Juul
arnej at solan11.solan.unit.no
Mon Jul 9 09:15:20 AEST 1990
In article <376 at demott.COM>, kdq at demott.COM (Kevin D. Quitt) writes:
|>..., and gnu's gcc
|>coredumps.
That is, you get a coredump on sscanf(str,"%d%n",&a,&b).
This is indeed correct, since your sscanf() (like mine) probably writes
to the format string or the argument str, and it isn't allowed to do that.
Try compiling with -fwritable-strings.
GCC puts string constants in the non-writable text segment by default.
Of course sscanf is broken, but that's our tough luck...
-- arnej at solan.unit.no -- juul at norunit.bitnet -- arnej at olga1.olga.unit.no --
-- This disclaimer intentionally left blank --
More information about the Comp.std.c
mailing list