| | |
Help plz
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Oct 2008
Posts: 2
Reputation:
Solved Threads: 0
i wanna noe how to write a code that will read lines from a file and then put those lines into an array. and will this make a double of arrayB if arrayA is empty and arrayB is filled? arrayA[10]=arrayB[10]
help of any kind will be greatly appreciated!
help of any kind will be greatly appreciated!
Last edited by Randomppl; Oct 9th, 2008 at 11:09 pm.
For file operations, look up the fstream header. The basic code looks something like this:
For your second question, you should probably read http://www.cplusplus.com/doc/tutorial/arrays.html
c++ Syntax (Toggle Plain Text)
#include <fstream> using namespace std; int main() { fstream file; file.open( "whatever.whatever" ); // Check to make sure the file is open with file.is_open() // Read data line by line using file.getline(); works just like cin.getline() // You can use file.eof() to check if you're at the end of the file (eof stands for end of file) file.close(); return 0; }
For your second question, you should probably read http://www.cplusplus.com/doc/tutorial/arrays.html
Last edited by Evan M; Oct 9th, 2008 at 11:39 pm.
![]() |
Similar Threads
- can someone plz help me with this? (Visual Basic 4 / 5 / 6)
- I NEED SUPPORT **"IMPORTANT"** PLZ HELP (Windows NT / 2000 / XP)
- Windows media player (Windows NT / 2000 / XP)
- Bridge.dll...Make it go away, Plz (Viruses, Spyware and other Nasties)
- can sum1 look @ dis plz (Viruses, Spyware and other Nasties)
- Hijackthis log file - plz help (Viruses, Spyware and other Nasties)
- IE not working...PLZ help :cry: (Web Browsers)
- PLZ help it's urgent! (Web Browsers)
- plz help ppl...... (Computer Science)
Other Threads in the C++ Forum
- Previous Thread: Using c++ to send email with smtp
- Next Thread: Doubly link list help
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline givemetehcodez graph iamthwee ifstream image input int java lib loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





