home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / alt / hackers / 1158 < prev    next >
Encoding:
Internet Message Format  |  1992-07-24  |  1.4 KB

  1. Path: sparky!uunet!cis.ohio-state.edu!rutgers!att!cbfsb!cbnewsg.cb.att.com!cooper
  2. From: cooper@cbnewsg.cb.att.com (Ralph 'Hairy' Moonen)
  3. Newsgroups: alt.hackers
  4. Subject: Re: not a test
  5. Message-ID: <1992Jul24.081515.20368@cbfsb.cb.att.com>
  6. Date: 24 Jul 92 08:15:15 GMT
  7. References: <1992Jul20.185304.837@amhux2.amherst.edu> <HWMHKR7@taronga.com>
  8. Sender: news@cbfsb.cb.att.com
  9. Organization: AT&T
  10. Lines: 30
  11. Approved: news@rutgers.rutgers.edu
  12.  
  13. In article <HWMHKR7@taronga.com>, peter@taronga.com (Peter da Silva) writes:
  14. > In article <1992Jul23.075512.21400@cbfsb.cb.att.com> cooper@cbnewsg.cb.att.com (Ralph 'Hairy' Moonen) writes:
  15. > >And you loose brownie points for using sscanf.
  16. > Agreed. Personally, I'd use strchr:
  17. >     i = 0;
  18. >     while(buf && *buf) {
  19. >         flds[i++] = buf;
  20. >         if(buf = strchr(buf, ' ')) {
  21. >             *buf++ = '\0';
  22. >             while(isspace(*buf)) buf++;
  23. >         }
  24. >     }
  25.  
  26. Well, I thought about it some more, and someone replied that my solution would
  27. be too inflexible. So first, we could externally #define the field separator.
  28. Now it's a space, but you could easily see it changed to \t in the future.
  29. The second is that maybe there are more than 1 FS's between the fields, so 
  30. you'd have to skip them.
  31.  
  32. That's all folks....
  33.  
  34. --Ralph Moonen
  35. -- 
  36. begin 644 ralph.pub
  37. MF58  ]M2*@QR86QP:%]M;V]N96[^ 6- RJ-V"2/)B4[K']_ZR@4#IVQE=TT6
  38. LHD.M[5JN9O_E1]Z9HXM/%A$WW.E[OA8>ES0S+;I@Q::BY.J8/Z]22#4% !$6
  39. end
  40.