Hello all,
I created a short program using <fstream>, and in it I created a file that I wanted to put information in, and later extract the information. (see code below) The problem is that it doesn't work - I'll input the data a second later and it doesn't display any information that it stored. Is this a code bug, or something in the way I compiled it?
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ code ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ #include <iostream> #include <fstream>
using namespace std;
char arr_words[50]; int fifty_one; ifstream fin("input.txt"); ofstream fout("input.txt");
int main() { fout << "Dude, am I coming in loud and clear?" << 51 << flush; //saves file inside project fout.close(); //close teh file!
fin.getline(arr_words, 49); //using getline to get whole words fin >> fifty_one; cout << fifty_one << endl << arr_words; fout << arr_words << fifty_one << flush; return 0; }
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
All help is appreciated and thanks in advance.
~ < [ / Adam-o \ ] > ~
+-------------------------------------------+ | My computer's Stats | | Mac OS 10.4.8 | | 1 Ghz Apple Powerbook G4 | | Xcode v. 2.4.1 | +-------------------------------------------+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Please keep your posts straight and to the point. Also please comment the code you use as I am still learning OpenGL and Xcode and may not yet understand the meaning of the command. Thank you. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|