cplusplus:file_processing_examples
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
cplusplus:file_processing_examples [2016/09/27 02:13] – [Filenames must be c_str in C++98 and earlier] mithat | cplusplus:file_processing_examples [2017/02/08 20:45] – [Checking for opening errors] mithat | ||
---|---|---|---|
Line 42: | Line 42: | ||
if (!outfile) | if (!outfile) | ||
- | cout << "Error opening file." << endl; | ||
- | else | ||
{ | { | ||
- | cout << "Writing to the file ... "; | + | cout << "Error opening |
+ | return 1; // exit program with an error code | ||
+ | } | ||
- | outfile | + | cout << "Writing to the file ... "; |
- | outfile << " | + | |
- | outfile << | + | |
- | outfile.close(); | + | |
- | | + | outfile << " |
- | } | + | outfile << " |
+ | outfile << " | ||
+ | outfile.close(); | ||
+ | |||
+ | | ||
return 0; | return 0; |
cplusplus/file_processing_examples.txt · Last modified: 2019/02/11 19:17 by mithat