這讓我非常煩惱,因爲我應該可以做到這一點,但是當我讀取十六進制數並在打印出來時將它分配給unsigned int時,我得到了不同的數字。任何建議都會很棒。謝謝從文件中讀取十六進制數
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
fstream myfile;
myfile.open("test.text");
unsigned int tester;
string test;
myfile >> hex >> tester;
cout << tester;
system("pause");
return 0;
}
有何不同?像不再是六角?請問'cout << hex << tester;'help? –
我從來不理解在評論中寫回答的人。 –
文件中有什麼? – shobhonk