|
|
1.1 ! root 1: #define MAXINTLENGTH 12 ! 2: char *icvt(value,ndigit,sign, base) long value; int *ndigit,*sign; ! 3: register int base; ! 4: { static char buf[MAXINTLENGTH+1]; ! 5: register int i; ! 6: if(value>0) *sign=0; ! 7: else if(value<0) ! 8: { value = -value; ! 9: *sign= 1; ! 10: } ! 11: else ! 12: { *sign=0; ! 13: *ndigit=1; ! 14: buf[MAXINTLENGTH]='0'; ! 15: return(&buf[MAXINTLENGTH]); ! 16: } ! 17: for(i=MAXINTLENGTH-1;value>0;i--) ! 18: { *(buf+i)=(int)(value%base)+'0'; ! 19: value /= base; ! 20: } ! 21: *ndigit=MAXINTLENGTH-1-i; ! 22: return(&buf[i+1]); ! 23: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.