| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | scanf() |
G'Day David,
-=> Quoting David Nugent to Frank Adam <=-
FA> I mean detecting on an empty line.
FA> That was the primary reason why i stopped using it.
DN> That depends entirely on what your parser string is, but yes, this is
DN> indeed one of the problems. You should understand that scanf()
DN> and family is for *parsing data*, not providing a user
Interesting how two simple words can jolt the brain sometimes,i've never
looked at scanf() in that specific way, makes more sense now.
DN> if (fgets(buffer,buflen,fp)==NULL)
DN> abort ...
DN> if ((p=strchr(buffer,'\n')) /* chop off newline */
DN> *p = '\0';
DN> if (sscanf(buffer,pattern,args...)==number_of_parse) {
DN> /* do your processing */
DN> }
Hmm, maybe it's not too late to start using it :)
L8r Frank (fadam{at}ozemail.com.au)
___ Blue Wave/DOS v2.21
--- Maximus 3.00
* Origin: The Software Parlour (3:635/544)SEEN-BY: 50/99 620/243 623/630 632/349 635/503 544 711/401 409 410 413 430 SEEN-BY: 711/510 808 809 932 934 712/515 713/888 714/906 800/1 7877/2809 @PATH: 635/544 50/99 711/808 809 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™.