home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 161_01 / 507.c < prev    next >
C/C++ Source or Header  |  1985-08-29  |  349b  |  23 lines

  1. #include "timer1.h"
  2.  
  3.     long value = 1<<25 - 1;
  4.     char buf[30];
  5.  
  6.     DO_IEXPR("Convert Long to ASCII")    ltoa(value, buf)    OD
  7. }
  8.  
  9. /*
  10.  *    convert a positive long integer into
  11.  *    a sequence of ASCII digits (decimal)
  12.  */
  13.  
  14. ltoa(value, buf)
  15. long value;
  16. char *buf;
  17. {
  18.     while (value > 0) {
  19.         *buf++ = (int)(value % 10) + '0';
  20.         value /= 10;
  21.     }
  22. }
  23.