home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20352 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  1.1 KB

  1. Path: sparky!uunet!europa.eng.gtefsd.com!emory!sol.ctr.columbia.edu!spool.mu.edu!olivea!sgigate!sgi!wdl1!pulsar!dboddy
  2. From: dboddy@pulsar.lrmsc.loral.com (Dave Boddy 5973)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Integter to ASCII conversions
  5. Message-ID: <1993Jan28.192812.3579@wdl.loral.com>
  6. Date: 28 Jan 93 19:28:12 GMT
  7. References: <19460002@hpcss01.cup.hp.com> <1993Jan28.152011.1308@uvm.edu>
  8. Sender: news@wdl.loral.com
  9. Organization: Loral Rolm Mil-Spec Computers
  10. Lines: 24
  11.  
  12. In article <1993Jan28.152011.1308@uvm.edu> cblaise@moose.uvm.edu (Chris Blaise,Free Amy Fisher!) writes:
  13. >
  14. >    Anyone know of a library function to convert an integer
  15. >to a string?  I've search high and low and am about to break
  16. >down and write my own...
  17. >
  18. > Thanks
  19. > TTYL
  20. > Chris
  21.  
  22. You can use the sprintf function to do this i.e.
  23.  
  24. int  num;
  25. char s[10];
  26.  
  27. num= 4;
  28. sprintf(s,"%d",num);
  29. /* s now has the ascii equivalent of num */
  30.  
  31.  
  32. -- 
  33. -----------------------------------------------------------------------------------
  34. Hey! They're lighting their arrows!...Can they DO that?   (Gary Larson)
  35. DoD # 0677   (408) 432-5973  dboddy@pulsar.lrmsc.loral.com
  36.