| delorie.com/archives/browse.cgi | search |
| Date: | Fri, 08 Aug 2003 10:36:37 +0200 |
| From: | "Eli Zaretskii" <eliz AT elta DOT co DOT il> |
| Sender: | halo1 AT zahav DOT net DOT il |
| To: | djgpp-workers AT delorie DOT com |
| Message-Id: | <1659-Fri08Aug2003103637+0300-eliz@elta.co.il> |
| X-Mailer: | emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 |
| In-reply-to: | <200308080701.JAA17576@lws256.lu.erisoft.se> (message from Martin |
| Stromberg on Fri, 8 Aug 2003 09:01:31 +0200 (MET DST)) | |
| Subject: | Re: (fwd) Re: sscanf's return value |
| References: | <200308080701 DOT JAA17576 AT lws256 DOT lu DOT erisoft DOT se> |
| 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 |
> From: Martin Stromberg <eplmst AT epl DOT ericsson DOT se>
> Date: Fri, 8 Aug 2003 09:01:31 +0200 (MET DST)
> >
> > 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 <stdio.h>
>
> int main()
> {
> char buff[4];
> int rc = sscanf("123", "%[0123456789]%*c", buff);
> printf("%d\n", rc);
> return 0;
> }
Thanks for this, but I still don't understand why returning a 0 when
the string is "" is a bug. Can you explain?
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |