diff options
| author | Birducken <[email protected]> | 2022-11-07 22:46:35 -0800 |
|---|---|---|
| committer | Birducken <[email protected]> | 2022-11-07 22:46:35 -0800 |
| commit | 7ba374d801b079805117f401adbcff273184a9d4 (patch) | |
| tree | a7b9a3b5ee8bb0d31cafcb1b277a8f455f26797a | |
| parent | Added erroneous file names. (diff) | |
| download | cst116-ch11-debugging-stark-7ba374d801b079805117f401adbcff273184a9d4.tar.xz cst116-ch11-debugging-stark-7ba374d801b079805117f401adbcff273184a9d4.zip | |
Added specific file error.
| -rw-r--r-- | CST116-Ch11-Debugging/CST116-Ch11-Debugging.cpp | 13 | ||||
| -rw-r--r-- | CST116-Ch11-Debugging/repor.txt | 0 |
2 files changed, 9 insertions, 4 deletions
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 <iostream> #include <fstream> // For the files!!!! #include <iomanip> // For manipulators & formatting options +#include <string> 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 --- /dev/null +++ b/CST116-Ch11-Debugging/repor.txt |