I am attempting to read a text file.
ifstream indata;
indata.open(filename);
if(!indata)
{
// file couldn't be opened
}
else
{
// file opened
}
// keep reading until end-of-file
string data;
while (getline(indata, data))
{
//this is where i want to store values
}
indata.close();
I want to read values from a text file. Im making the text file so I can read it however. This is a simple example of what I was thinking:
////text file/////
1 2 3 4
5 6 7 8
9 10 11 12
////text file/////
How do I store these values into a 2 dimensional array?