| delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
| Message-ID: | <4137F344.F8365E09@yahoo.com> |
| From: | CBFalconer <cbfalconer AT yahoo DOT com> |
| Organization: | Ched Research |
| X-Mailer: | Mozilla 4.75 [en] (Win98; U) |
| X-Accept-Language: | en |
| MIME-Version: | 1.0 |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: scanf: strange behavior? |
| References: | <20040902144152 DOT GH6858 AT webhome DOT cz> <2pp00iFnf7nsU1 AT uni-berlin DOT de> <41374c9c$0$173$cc7c7865 AT news DOT luth DOT se> <20040902184005 DOT GA23943 AT webhome DOT cz> <41378A42 DOT 5040801 AT acm DOT org> <200409022144 DOT i82LiDLe005751 AT envy DOT delorie DOT com> <20040902221157 DOT GB7970 AT webhome DOT cz> <200409022230 DOT i82MUuqE006471 AT envy DOT delorie DOT com> <9ccfj0hufuh2nii5jfjqlqgbf3g7b34mo6 AT 4ax DOT com> |
| Lines: | 36 |
| Date: | Fri, 03 Sep 2004 05:03:28 GMT |
| NNTP-Posting-Host: | 12.76.138.88 |
| X-Complaints-To: | abuse AT worldnet DOT att DOT net |
| X-Trace: | bgtnsc04-news.ops.worldnet.att.net 1094187808 12.76.138.88 (Fri, 03 Sep 2004 05:03:28 GMT) |
| NNTP-Posting-Date: | Fri, 03 Sep 2004 05:03:28 GMT |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Brian Inglis wrote:
> DJ Delorie <dj AT delorie DOT com> wrote:
>
... snip ...
>
> "7.19.6.2#16 The fscanf function returns the value of the macro EOF if
> an input failure occurs before any conversion. Otherwise, the function
> returns the number of input items assigned, which can be fewer than
> provided for, or even zero, in the event of an early matching
> failure."
>
> >The appropriate test cases are thus, for "%d %d":
>
> IMHO according to info and standard, results should be:
> > ""
> input failure - terminator - returns EOF
> > "x"
> matching failure - returns 0
> > "5"
> input failure - terminator - returns 1
> > "5 x"
> matching failure - returns 1
> > "5 5"
> success - returns 2
> > "5 5 x"
> success - returns 2 - " " scanned and pushed back - "x" unscanned
I agree with your interpretation. AFAICS DJGPP 2.03 complies.
--
"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |