Download DSP563CCC DSP56300 Family Optimizing C Compiler User`s Manual
Transcript
strtol
strtol
EXAMPLE
#include <stdio.h>
#include <stdlib.h>
void main()
{
char* hexstr = "0x3cdef709hexstr stopped";
char* decstr = "709709709decstr stopped";
char* octstr = "012341234octstr stopped";
char* stopped;
long result;
printf( "result\t\tstop string\n" );
result = strtol( hexstr, &stopped, 16 );
printf( "%lx\t\t%s\n", result, stopped );
result = strtol( decstr, &stopped, 10 );
printf( "%ld\t\t%s\n", result, stopped );
result = strtol( octstr, &stopped, 8 );
printf( "%lo\t\t%s\n", result, stopped );
}
prints to standard output:
result
stop string
3cdef709
hexstr stopped
709709709
decstr stopped
12341234
octstr stopped
MOTOROLA
DSP563CCC User’s Manual
A-147