Reading from a text file.

Jan 24, 2013 at 5:21pm
The idea of this application is to read words stored in a text file.
For example, I have a text file with three names on it, two separated by a white space. and then a third name separated by a line.
// ex:
Brandon Josh
Dish
//
Is there a way to read those words, and assign them to their own string?
Jan 24, 2013 at 7:17pm
1
2
3
4
5
6
7
8
    if (filein.is_open())
    {
		while ( filein.good() )
		{
		filein >> value;
		cout << value << endl;
		}	
    }


Then just assign value to some string, you can do that with a for loop and an array, or you could just do string A, B, C;
Jan 28, 2013 at 4:14am
thank you
Topic archived. No new replies allowed.