==============================
void ultoa(unsigned char *str, unsigned long ul, unsigned char length) {
do {
str[length--]=(ul % 10) + '0';
ul = ul / 10;
} while (ul); //eliminates leading zeros
//} while (length); //keeps leading zeros
}
==============================
so a the following
ultoa (&vRAM[3], 123, 10);
will create a string of ' 123', starting at vRAM[3]. no trailing null, however.
I use a custom itoa to do that.
==============================
void ultoa(unsigned char *str, unsigned long ul, unsigned char length) {
do {
str[length--]=(ul % 10) + '0';
ul = ul / 10;
} while (ul); //eliminates leading zeros
//} while (length); //keeps leading zeros
}
==============================
so a the following
ultoa (&vRAM[3], 123, 10);
will create a string of ' 123', starting at vRAM[3]. no trailing null, however.
一周热门 更多>