UNKNOWN //************************************** // Name: C++ File I/O Examples // Description:This demonstrates an example of C++'s fstream File I/O. Very simple; the basic stuff for beginners to learn from. If you would like to see how to do something more in the direction this code leads, comment on (and rate) it telling me what specifically you want to see and I'll be glad to suffice. // By: *LuckY* // // // Inputs:None // // Returns:None // //Assumes:None // //Side Effects:None //This code is copyrighted and has limited warranties. //Please see http://www.Planet-Source-Code.com/xq/ASP/txtCodeId.930/lngWId.3/qx/vb/scripts/ShowCode.htm //for details. //************************************** // // lucky760@yahoo.com // #include <fstream> const char *FILENAME = "FILE.txt"; int main() { //create output object associated w/ file ofstream fout(FILENAME); cout &lt;&lt; "Enter your secret password: "; char str[60]; cin &gt;&gt; str; //write to file fout &lt;&lt; "This is your secret password. Don't give it to anyone!\n"; fout &lt;&lt; str; //close file fout.close(); cout &lt;&lt; endl; ifstream fin(FILENAME); char ch; while (fin.get(ch)) cout &lt;&lt; ch; fin.close(); return 0; }