I need to compare 8 bit hexadecimal numbers in a text file with those i've created. Problem is that the ones in the text file are 8 bit with the leading 0's included. E.g the number 255 is represented as: 0x000000FF while my program is outputting the same number as: 0xFF. How do I add those leading zeros to my hexadecimal numbers? Is there a way of doing this?
I am storing them both as strings and need to compare them and recognize when they are equal. i.e I need the program to recognize that 0x000000FF=0xFF but when they're held as strings it wont see them as equal, correct (I haven't tried it)?
The reason they're being held as strings is that I'm using the getline member of a fstream object and I don't think there's an equivalent "getnumber" function, right?