Guarda copia del fichero original

This commit is contained in:
2023-04-22 15:14:09 +02:00
parent ee98d41432
commit cb3a8b0110
+6 -4
View File
@@ -74,6 +74,8 @@ void printBuffer()
int calcChecksum()
{
saveFile(filePath + ".bak");
int sum = 0;
for (int i = firstByte; i <= lastByte; i++)
{
@@ -93,10 +95,10 @@ int main(int argc, char *argv[])
int sum = calcChecksum();
saveFile(filePath);
cout << hex;
cout << "0x" << checksum1 << ": 0x" << static_cast<unsigned>(buffer.at(checksum1)) << endl;
cout << "0x" << checksum2 << ": 0x" << static_cast<unsigned>(buffer.at(checksum2)) << endl;
cout << "checksum (0x" << firstByte << " .. 0x" << lastByte << "): 0x" << sum << endl;
//cout << hex;
//cout << "0x" << checksum1 << ": 0x" << static_cast<unsigned>(buffer.at(checksum1)) << endl;
//cout << "0x" << checksum2 << ": 0x" << static_cast<unsigned>(buffer.at(checksum2)) << endl;
//cout << "checksum (0x" << firstByte << " .. 0x" << lastByte << "): 0x" << sum << endl;
return 0;
}