You could use fstream for reading in the data but personally I dislike reading this way much of the time - I prefer to read a line at a time then tokenize it. boost::tokenizer is good for this but if you don't have that, it is simple enough to write your own in a couple of lines with std::string's "find" or "find_first_of" command.

The "0x" is used only for code and isn't part of the input/output of a hex number. You'd have to cut that off before converting (which is why tokenizing can be good in this instance).