home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / alt / hackers / 1148 < prev    next >
Encoding:
Text File  |  1992-07-23  |  1.0 KB  |  33 lines

  1. Newsgroups: alt.hackers
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!menudo.uh.edu!sugar!taronga!peter
  3. From: peter@taronga.com (Peter da Silva)
  4. Subject: Re: not a test
  5. Message-ID: <HWMHKR7@taronga.com>
  6. Sender: peter@taronga.com (Peter da Silva)
  7. Organization: Taronga Park BBS
  8. References: <1992Jul20.185304.837@amhux2.amherst.edu> <ik89NB1w164w@kzdoos.hacktic.nl> <1992Jul23.075512.21400@cbfsb.cb.att.com>
  9. Date: Thu, 23 Jul 1992 12:27:42 GMT
  10. Approved: peter@taronga.com
  11. Lines: 20
  12.  
  13. In article <1992Jul23.075512.21400@cbfsb.cb.att.com> cooper@cbnewsg.cb.att.com (Ralph 'Hairy' Moonen) writes:
  14. >And you loose brownie points for using sscanf.
  15.  
  16. Agreed. Personally, I'd use strchr:
  17.  
  18.     i = 0;
  19.     while(buf && *buf) {
  20.         flds[i++] = buf;
  21.         if(buf = strchr(buf, ' ')) {
  22.             *buf++ = '\0';
  23.             while(isspace(*buf)) buf++;
  24.         }
  25.     }
  26.  
  27. Don't forget to null-terminate the strings!
  28. -- 
  29.                                                                 `-_-'
  30.                          Have you hugged your wolf today?        'U`
  31.  
  32. Peter da Silva, Taronga Park BBS, Houston, TX  +1 713 568 0480/1032
  33.