From 7ba374d801b079805117f401adbcff273184a9d4 Mon Sep 17 00:00:00 2001 From: Birducken Date: Mon, 7 Nov 2022 22:46:35 -0800 Subject: Added specific file error. --- CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp | 13 +++++++++---- CST116-Ch11-Debugging/repor.txt | 0 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 CST116-Ch11-Debugging/repor.txt diff --git a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp index 23be1a4..e8e54d8 100644 --- a/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp +++ b/CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp @@ -55,11 +55,13 @@ #include #include // For the files!!!! #include // For manipulators & formatting options +#include using std::cin; using std::cout; using std::endl; using std::setw; using std::ios; +using std::string; using std::ifstream; using std::ofstream; @@ -67,6 +69,9 @@ using std::ofstream; const int EMPLOYEES = 20; const int MAX = 21; +const string inPath = "dat.txt"; +const string outPath = "repor.txt"; + int ReadData(ifstream& inFile, ofstream& outFile, char name[][MAX], int age[]); void WriteOutputFile(ofstream& outFile, char name[][MAX], int age[], int counter); @@ -81,9 +86,9 @@ int main() ifstream inFile; // Notice how this automatically opens the file - ofstream outFile("repor.txt"); + ofstream outFile(outPath); - inFile.open("dat.txt"); + inFile.open(inPath); if (inFile.is_open()) { @@ -98,13 +103,13 @@ int main() } else { - cout << "Trouble Opening File"; + cout << "Trouble Opening " << outPath; cout << "\n\n\t\t ** About to EXIT NOW! ** "; } } else { - cout << "Trouble Opening File"; + cout << "Trouble Opening " << inPath; cout << "\n\n\t\t ** About to EXIT NOW! ** "; } return 0; diff --git a/CST116-Ch11-Debugging/repor.txt b/CST116-Ch11-Debugging/repor.txt new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3