Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!cs.utexas.edu!rutgers!njin!uupsi!sunic!nuug!sigyn.idt.unit.no!solan11.solan.unit.no!arnej From: arnej@solan11.solan.unit.no (Arne Henrik Juul) Newsgroups: comp.std.c Subject: Re: Explain this sscanf behavior. Keywords: sscanf ANSI Message-ID: <1990Jul8.231520.27479@idt.unit.no> Date: 8 Jul 90 23:15:20 GMT References: <1990Jul6.181830.2549@tc.fluke.COM> <376@demott.COM> Sender: news@idt.unit.no (Usenet news admin) Reply-To: arnej@solan1.solan.unit.no Organization: Norwegian Institue of Technology Lines: 15 In article <376@demott.COM>, kdq@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@solan.unit.no -- juul@norunit.bitnet -- arnej@olga1.olga.unit.no -- -- This disclaimer intentionally left blank --