I am trying to read a string(ver
) from a binary file. the number of characters(numc
) in the string is also read from the file.This is how I read the file:
uint32_t numc;
inFile.read((char*)&numc, sizeof(numc));
char* ver = new char[numc];
inFile.read(ver, numc);
cout << "the version is: " << ver << endl;
what I get is the string that I expect plus some other symbols. How can I solve this problem?