Subversion Repositories Kolibri OS

Rev

Rev 647 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5.  
  6. /*
  7. ** itoa(n,s) - Convert n to characters in s
  8. */
  9. char* itoa(int n,char* s)
  10. {
  11.   int sign;
  12.   char *ptr;
  13.   ptr = s;
  14.   if ((sign = n) < 0) n = -n;
  15.   do {
  16.     *ptr++ = n % 10 + '0';
  17.     } while ((n = n / 10) > 0);
  18.   if (sign < 0) *ptr++ = '-';
  19.   *ptr = '\0';
  20.   return strrev(s);
  21. }
  22.  
  23.