Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!amdcad!sun!pitstop!sundc!seismo!uunet!bywater!acheron!scifi!njs From: njs@scifi.scifi.UUCP (Nicholas J. Simicich;?) Newsgroups: comp.bugs.sys5 Subject: Re: bug in sscanf (scanf)? Message-ID: Date: 17 Nov 88 23:40:06 GMT References: <331@zeus.hf.intel.com> Sender: njs@scifi.UUCP Organization: Nick Simicich, Peekskill, NY Lines: 16 In-reply-to: martin@zeus.hf.intel.com's message of 16 Nov 88 18:51:56 GMT In article <331@zeus.hf.intel.com> martin@zeus.hf.intel.com (Martin Wilde) writes: > I have a small fragment of code that does not work on V.3.2 386 UNIX. > The problem appears to be in sscanf (scanf). The following fragment of > code shows the problem. ..... > (void) sscanf(optarg, "%d %s %s %s %255[^\0]", ×, s1, s2, s3, s4); The bug is actually in the representation of a string in C, of course (no flames please). The format string is being passed to sscanf as: "%d %s %s %s %255[^" Since the \0 is an end of string character. So sscanf can't interpret what you intended. -- Nick Simicich --- uunet!bywater!scifi!njs --- njs@ibm.com (Internet)