txt application

how do I create an application that is capable of reading in from a text file (.txt extension) using "fstream"?
Read: http://cplusplus.com/reference/iostream/ifstream/

Creating an ifstream from a text file:

 
ifstream inFile( "some_file.txt" );


Reading and storing a single character:

1
2
char c;
inFile.get( c );


Reading and storing a whole line:

1
2
String s;
getline( inFile, s );
Last edited on
I also recommend you look at std::deque for storing the lines.
Topic archived. No new replies allowed.