-
verify a file opened
I'm writing a program and have to verify that the file open command did succeed
and if not the program will write a message to that effect and then terminate
then we have to prompt the user for strings of data until the user wants
to quit. Any suggestions on this would be greatly appreciated.
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
#include <stdlib.h>
#include <conio.h>
main()
{ ofstream outPutFile("ATxtFile.dat", ios::app);
char our_String[80];
cout << "We will be adding data to textfile :";
cout << "\n\nENTER a string (press ENTER only to quit): "
<< endl;
cin.getline(our_String, 80, '\n');
outPutFile << our_String
<< endl;
outPutFile.close();
return 0;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|