| ??? 11/20/02 04:05 Read: times |
#32803 - RE: convert a large hex number to ascii |
If I recall, you use C. I threw this together for you. It should give you the idea on one way to do it, then modify to suit your needs.
GRRR... For the life of me, I can't prevent the double spacing in this example. My apologies. /************************************************************
*
* NAME: ltoa
* PURPOSE: Convert signed long to decimal string.
*
* SYNOPSIS:
*
* void ltoa( char *s, long bin, unsigned char n );
*
* DESCRIPTION:
*
* The function stores a NUL-terminated string, in "n" +
* 1 (plus 1 for the NUL string terminator) successive
* elements of the array whose first element has the
* address "s", by converting "bin" to a sign character
* followed by "n" - 1 decimal characters.
*
************************************************************/
void ltoa( char *s, long bin, unsigned char n )
{
if (bin >= 0)
*s = '+';
else
{
*s = '-';
bin = -bin;
}
s += n;
*s = ' ';
while (--n)
{
*--s = (bin % 10) + '0';
bin /= 10;
}
} |
| Topic | Author | Date |
| convert a large hex number to ascii | 01/01/70 00:00 | |
| RE: convert a large hex number to ascii | 01/01/70 00:00 | |
| RE: convert a large hex number to ascii | 01/01/70 00:00 | |
| RE: convert a large hex number to ascii | 01/01/70 00:00 | |
| RE: convert a large hex number to ascii | 01/01/70 00:00 | |
| RE: convert a large hex number to ascii | 01/01/70 00:00 | |
| RE: convert a large hex number to ascii | 01/01/70 00:00 | |
| RE: convert a large hex number to asc | 01/01/70 00:00 | |
RE: convert a large hex number to ascii | 01/01/70 00:00 |



