判斷計算機的字節順序是little endian仍是big endian

bool IsBig_Endian()ide

//若是字節序爲big-endian,返回true;it

//反之爲   little-endian,返回falseclass

{test

    unsigned short test = 0x1122;di

    if(*( (unsigned char*) &test ) == 0x11)view

       return TRUE;vi

elseco

    return FALSE;editor

}//IsBig_Endian()return

相關文章
相關標籤/搜索