Im making college project to code and decode files. I want it to run from command line something like this:
myapp file_name -code
myapp file_name -decode
How do I get path to file in directory where I opened CMD and how do I save file to same directory? My code if its needed:
int main(int argc, char *argv[]) {
std::cout << argv[1] << std::endl;
if (argv[2] == "code" || argv[2] == "c") {
try {
WriteAllBytes("coded.gau", StringToCharVector(Code(CharVectorToString(ReadAllBytes(argv[1])))));
} catch (...) {
std::cout << "Exception!" << std::endl;
}
} else if (argv[2] == "decode" || argv[2] == "d") {
try {
WriteAllBytes("coded.gau", StringToCharVector(Decode(CharVectorToString(ReadAllBytes(argv[1])))));
} catch (...) {
std::cout << "Exception!" << std::endl;
}
}
}