I'm making a project that dumps a file by putting the offsets (hexadecimal). I must put the hexadecimal with 0x like 0xBEE4DC because the application will crash or return an error if I put a hexadecimal without 0x like BEE4DC. Is there a way to put the hexadecimal without "0x" ?
This is my code. i'm keeping this project secret so I don't show more code than this.
dump1.cpp
void LoadMetadata(char* szFile)
{
string mystr;
int offset2;
int offset1;
std::cout << "Input unknown offset #1: ";
getline(cin, mystr);
stringstream(mystr) >> offset1;
std::cout << "Input unknown offset #2: ";
getline(cin, mystr);
stringstream(mystr) >> offset2;
std::cout << "\n";
...
}
dump2.cpp
static int offset2;
static int offset1;
void LoadDumpLib(char* szFile)
{
...
pCodeRegistration = (DumpCodeRegistration*)MapVATR(offset2, pLibIl2Cpp);
pMetadataRegistration = (DumpMetadataRegistration*)MapVATR(offset1, pLibIl2Cpp);
...
}
This code should work
std::cout << "Input unknown offset #1: ";
getline(cin, mystr);
stringstream(mystr) >> hex >> offset1;
std::cout << "Input unknown offset #2: ";
getline(cin, mystr);
stringstream(mystr) >> hex >> offset2;
std::cout << "\n";