home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / sgi / 16505 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.0 KB  |  35 lines

  1. Path: sparky!uunet!stanford.edu!rutgers!cmcl2!adm!news
  2. From: karron@karron.med.nyu.edu (Dan Karron (karron@nyu.edu))
  3. Newsgroups: comp.sys.sgi
  4. Subject: Re: Nawk Bug NOT!
  5. Message-ID: <34114@adm.brl.mil>
  6. Date: 16 Nov 92 20:36:20 GMT
  7. Sender: news@adm.brl.mil
  8. Lines: 25
  9.  
  10. The syntax is ?? Wrong ?? for sprintf.
  11. This works.
  12. Putting the target of the sprintf assignment inside the
  13. braces doe not work. Nawk sprintf returns its value as
  14. a function, unlike the C analog.               
  15.  
  16. prog='
  17. BEGIN {
  18.       i=1
  19.       printf("%03d\n",i);
  20.       string=sprintf("%03d",i);
  21.       print "string=",string
  22.       }
  23. '
  24. nawk "$prog"
  25.  
  26. Thanks to John Rupley at cs.arizona.edu for pointing this out to me.
  27.  
  28. Dan.
  29.  
  30. | karron@nyu.edu (e-mail alias )         Dan Karron, Research Associate      |
  31. | Phone: 212 263 5210 Fax: 212 263 7190  New York University Medical Center  |
  32. | 560 First Avenue                       Digital Pager  <1>  212 397 9330    |
  33. | New York, New York 10016               <2> 10896   <3> <your-number-here>  |
  34. ``Too busy doing to write about it, too busy writing to do anything about it.''
  35.