TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Paul Edwards
from: Roy McNeill
date: 1995-03-28 19:16:54
subject: emx bug

Hi Paul



 PE> #include 



 PE> int main(void)

 PE> {

 PE>     char buf[50] = "5 6";

 PE>     int x, y;

 PE>     int ret;



 PE>     ret = sscanf(buf, "%d %d p", &x, &y);

 PE>     printf("ret is %d\n", ret);

 PE>     return (0);

 PE> }



 RM> Dunno about EMX, but quoting from my much-maligned Borland manual,



 RM> "If sscanf attempts to read at end-of-string, the return value
is EOF."



 PE> And what happens when you run this program using your Borland

 PE> compiler?  BFN.



 Odd. I can't

get it to return EOF (BC3.0 and BC4.02), even with



     int x,y,z;

     char buf[50] = "5 6";

     ret = sscanf(buf, "%d %d %d", &x, &y, &z);



It just returns the number of fields read and converted. Perhaps

the Borland line should have read "If sscanf attempts to start

reading at end-of-string, the return value is EOF."



What does the standard say it should do?



Cheers



--- PPoint 1.88


* Origin: Silicon Heaven (3:711/934.16)
SEEN-BY: 711/809 934
@PATH: 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.