| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
| 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. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/xcode-users/email@hidden This email sent to email@hidden
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.