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

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