[an error occurred while processing this directive]
|
/* Convert integer 'i', radix 10 to a string */
void
itoa10(unsigned char *buf, int i) {
unsigned int rem;
unsigned char *s,length=0;
s = buf; s = buf;
E-mail:
info@telesys.ru
if (i == 0)
*s++ = '0';
else {
if (i < 0) {
*buf++ = '-';
s = buf;
i = -i;
}
while (i) {
++length;
rem = i % 10;
*s++ = rem + '0';
i /= 10;
}
for(rem=0; ((unsigned char)rem)
*(buf+((unsigned char)rem)) = *(buf+(length-((unsigned char)rem)-1));
*(buf+(length-((unsigned char)rem)-1)) = *(buf+length);
}
}
*s=0;
}
/* Convert integer 'i', radix 'base' to a string */
void
itoa(unsigned char *buf, int i, unsigned char base) {
unsigned int rem;
unsigned char *s,length=0;
if (i == 0)
*s++ = '0';
else {
if (i < 0) {
if (base <=10) {
*buf++ = '-';
s = buf;
}
i = -i;
}
while (i) {
++length;
rem = i % base;
if (rem <= 10)
*s++ = rem + '0';
else if (base <= 16)
*s++ = "abcdef"[rem - 10];
i /= base;
}
for(base=0; base
*(buf+base) = *(buf+(length-base-1));
*(buf+(length-base-1)) = *(buf+length);
}
}
*s=0;
}
Ответы