Monday, May 24, 2010

C++ fstream help?

First off im not even sure if the function im looking for is in the fstream library. What I'm trying to do is make a program that fetches lines from a textfile and writes them to a separat string for each line. Lets say i have a 3 line text file that looks like this





hello


whats up


nose





i want the program to write line 1 "hello" to a string, and line 2 to a different string, and so forth, how would i do this?

C++ fstream help?
Do you want to store each line for later processing, or do you want to just print out what's in the file, one line at a time?
Reply:You would need to declare an array of strings, and read each line into the next index.


No comments:

Post a Comment