????Windows??Linux????????????
???????????? ???????[ 2013/3/12 10:17:44 ] ????????
??????????????????Щ??Windows??????д?????????????????Linux?????????С????????????????????????????????????????????????????????Windows?????Linux??
????1????Linux???Win32 API?GetTickCount????
????????Windows?е?GetTickCount API?????????Linux????????????μ????
long GetTickCount()
{
tms tm;
return times(&tm);
}
????2??Windows??Linux??????itoa?????????
???????????????Windows??STL?????????Linux?????????Linux????STL??????????itoa?????????itoa??Linux????????????????????GCC?????н???STL????????????????????STL???????????????????????????????е????????????????????????????????д?Windows??Linux???????
#if defined(__linux__)
#define _itoa itoa
char* itoa(int value?? char* str?? int radix)
{
int rem = 0;
int pos = 0;
char ch = ''!'' ;
do
{
rem = value % radix ;
value /= radix;
if ( 16 == radix )
{
if( rem >= 10 && rem <= 15 )
{
switch( rem )
{
case 10:
ch = ''a'' ;
break;
case 11:
ch =''b'' ;
break;
case 12:
ch = ''c'' ;
break;
case 13:
ch =''d'' ;
break;
case 14:
ch = ''e'' ;
break;
case 15:
ch =''f'' ;
break;
}
}
}
if( ''!'' == ch )
{
str[pos++] = (char) ( rem + 0x30 );
}
else
{
str[pos++] = ch ;
}
}while( value != 0 );
str[pos] = ''