Thu Nov 13, 2008 6:25 pm
#include <fstream>
const char *FILENAME = "FILE.txt";
int main() {
//create output object associated w/ file
ofstream fout(FILENAME);
cout << "Enter your secret password: ";
char str[60];
cin >> str;
//write to file
fout << "This is your secret password. Don't give it to anyone!\n";
fout << str;
//close file
fout.close();
cout << endl;
ifstream fin(FILENAME);
char ch;
while (fin.get(ch))
cout << ch;
fin.close();
return 0;
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.