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