Pretty much what it says in the title, _orgDrspath = std::string, newDrsName = std::string
std::cout << "Opening original " << _orgDrsPath << std::endl;
// Store all bytes into a variable called exe
std::ifstream inFileDrs(_orgDrsPath, std::ios::in | std::ios::binary);
inFileDrs.seekg(0, std::ios::end);
size_t len = inFileDrs.tellg();
int newLen = 1024*1024;
char *theDrs = new char[len];
inFileDrs.seekg(0, std::ios::beg);
inFileDrs.read(theDrs, len);
char *newDrs = new char[newLen];
std::ofstream outFileDrs(newDrsName, std::ios::out | std::ios::binary);
std::cout << "Creating patched drs file " << newDrsName << std::endl;
std::cout << "Patching DRS " << _orgDrsPath << std::endl;
// Header consists of Text, then 0x1A EOF, then some 0x00's, then the version
// The following code reads the whole header AND the first byte of the Version
bool foundEof = false;
char *byt = new char[1];
while (true)
{
inFileDrs.read(byt, 1);
outFileDrs.write(byt, 1);
std::cout << int(byt) << std::endl;
if (int(byt) == 0x1A)
{
std::cout << "Pass" << std::endl;
foundEof = true;
}
else if (byt != '\0' && foundEof)
break;
delete [] byt;
byt = new char[1];
}