From aecc11163f8b7b8336c1f9677fd970c9a4f45f98 Mon Sep 17 00:00:00 2001 From: Jordan Cristiano Date: Thu, 25 Jun 2015 00:00:30 -0400 Subject: [PATCH] Added error check for if the input and output files are the same --- demboyz/demboyz.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/demboyz/demboyz.cpp b/demboyz/demboyz.cpp index 974cfab..73f4950 100644 --- a/demboyz/demboyz.cpp +++ b/demboyz/demboyz.cpp @@ -52,6 +52,11 @@ int main(const int argc, const char* argv[]) std::string inputFile(argv[1]); std::string outputFile(argv[2]); + if (inputFile == outputFile) + { + fprintf(stderr, "Error: Input and output file cannot be the same!\n"); + return -1; + } FileType inputType = GetFileType(inputFile); FileType outputType = GetFileType(outputFile);