home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sun4nl!hacktic!blackhl!kzdoos!koos
- From: koos@kzdoos.hacktic.nl (Koos van den Hout)
- Newsgroups: alt.hackers
- Subject: Re: not a test
- Message-ID: <ik89NB1w164w@kzdoos.hacktic.nl>
- Date: Tue, 21 Jul 92 09:46:41 MET
- References: <1992Jul20.185304.837@amhux2.amherst.edu>
- Organization: Koos z'n Doos (BBS)
- Approved: I use Waffle so this is easy
- Lines: 38
-
- twpierce@amhux1.amherst.edu (Tim Pierce) writes:
-
- > ObHack: convincing MS-Windows 3.0 and a third-party screen saver to
- > coexist in peaceful harmony.
- >
- > (Do I lose brownie points for even mentioning Windows on alt.hackers?)
-
- Yup. Windows is so much used and mentioned by normal lusers that it costs you
- brownie points to mention it here....
-
- ObHack : In a program I'm working on I need to parse lines that are in
- the form :
- <name> <value> <value> <string> [<string>...]
- So 'group_A 0 0 aaa' is valid but 'group_B 10 0 bb1 bb2 bb3' also.
- Problem : How to parse this when the complete line is already stored in memory?
- Solution:
-
- The line is stored in char buf[512];
-
- int nm,inc;
-
- sscanf(buf,"%s %d %d%n",name,&val1,&val2,nm);
- /* do something with the name and val1 and val2 */
-
- while(sscanf(&buf[nm],"%s%n",member,&inc)==1){
- nm+=inc;
- /* do something with member */
- }
-
- Works like a charm....
-
- Grtx. KH
-
-
- | Koos van den Hout E-mail koos@kzdoos.hacktic.nl |
- | Student Computer Science Fido Sysop @ 2:500/101.11012 |
- | SysOp BBS Koos z'n Doos (+31-3402-36647) 300/1200/2400N81 ANSI/AVT/TTY |
- | International E-mail costs me 10 times as much as a followup ... |
-