c++ - Reading in HEX number from file -
this has me pretty bothered should able when read in hex number , assign unsigned int when print out different number. advice great. thanks
#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; }
i bet don't "different number".
i bet same value, in decimal representation.
you're extracting hex-representation value (myfile >> hex >> tester
); insert one, (cout << hex << tester
)!
Comments
Post a Comment