Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/20/02 04:21
Read: times


 
#32804 - RE: convert a large hex number to ascii
Sheesh, it used to be that on this forum, bracketing code with <pre> </pre> would preserve formatting and content, but I see now that not only was my post afflicted with double-spacing, but the line after "s += n;" was affected also. Hopefully you can get the gist of the code without the <pre> </pre> in the example below.

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;
    }
}


List of 9 messages in thread
TopicAuthorDate
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      

Back to Subject List