X-Sybari-Space: 00000000 00000000 00000000 00000000 From: Martin Stromberg Message-Id: <200308080701.JAA17576@lws256.lu.erisoft.se> Subject: Re: (fwd) Re: sscanf's return value To: djgpp-workers AT delorie DOT com Date: Fri, 8 Aug 2003 09:01:31 +0200 (MET DST) In-Reply-To: <200308071532.RAA17010@lws256.lu.erisoft.se> from "Martin Stromberg" at Aug 07, 2003 05:32:34 PM X-Mailer: ELM [version 2.5 PL3] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: Dan DOT Pop AT cern DOT ch (Dan Pop) > Newsgroups: comp.std.c > Subject: Re: sscanf's return value > Date: 4 Aug 2003 12:02:18 GMT > Message-ID: > > In "Arthur J. O'Dwyer" writes: > > > >On Thu, 31 Jul 2003, Stefan Farfeleder wrote: > >> > >> Arthur J. O'Dwyer wrote: > >> > On Thu, 31 Jul 2003, Bruce Wheeler wrote: > >> >> On 31 Jul 2003 11:17:13 GMT, Dan DOT Pop AT cern DOT ch (Dan Pop) wrote: > >> >> > > >> >> > #include > >> >> > > >> >> > int main() > >> >> > { > >> >> > int rc = sscanf("123", "%*[0123456789]%*c"); > >> >> > printf("%d\n", rc); > >> >> > return 0; > >> >> > } > >> > >> > gcc, presumably the compiler Dan used too, reports -1 and 1. ... > >Thanks for the correction. I must have been extra clueless today, > >because I see DJGPP produces the right answers (0 and 1) - which > >means I must've only tested the code on the Linux implementation. > >... I wonder how one would go about rectifying such a thing... > > OTOH, DJGPP will output 0 even if the input string is "" in the code > quoted above. So, DJGPP's sscanf is broken, too, just in a different > way :-) The second return value they are talking about is when the code is changed to #include int main() { char buff[4]; int rc = sscanf("123", "%[0123456789]%*c", buff); printf("%d\n", rc); return 0; } Right, MartinS