[todanano@localhost tmp]$ vi a.cpp
[todanano@localhost tmp]$ cat a.cpp
#include <stdio.h>
#include <stdlib.h>
#include <string>
int main( int argc, char **argv ) {
std::string str = "FF";
long num = strtol( str.c_str(), NULL, 16 );
printf( "%ld\n", num );
return( 0 );
}
[todanano@localhost tmp]$
[todanano@localhost tmp]$ g++ ./a.cpp
[todanano@localhost tmp]$ ./a.out
255
[todanano@localhost tmp]$
[todanano@localhost tmp]$
息抜きにちょろっと書いただけです。はい。