Added ability to write to file

This commit is contained in:
2017-09-07 11:00:14 -05:00
parent c71a44d575
commit 5b0aafb1dc
2 changed files with 14 additions and 2 deletions

View File

@@ -2,11 +2,10 @@
Compiler: MinGW g++ 6.3.0 (Windows)
MinGW g++ 5.3.1 (Ubuntu 16.04)
Flags: -std=c++11 -static-libgcc -static-libstdc++ -lws2_32
Run ex: cardnet.exe -c1="G:\card0.txt" -c2="H:\card0.txt" -l1="G:\check.txt" -l2="H:\check.txt" -p="4500"
Run ex: cardnet.exe -p1="G:\card0.txt" -p2="H:\card0.txt" -c1="G:\check.txt" -c2="H:\check.txt" -p="4500"
TODO:
Fix extra buffer character (maybe, it occurs in telnet)
Change card0.txt file based on information given by client (p1/p2)
*/
#include <iostream>
@@ -333,4 +332,17 @@ bool overwriteCard(std::string buffer, std::string location)
// check if card exists
debugOutput("Card data: " + card + "\n");
// try to write card file
std::ofstream cardFile(location);
if(cardFile.is_open())
{
cardFile << card;
cardFile.close();
debugOutput("Successfully written card number to: " + location + "\n");
}
else
{
debugOutput("Unable to write to card in: " + location + "\n");
}
}

Binary file not shown.