Opening and Reading a file, easy question
Hi All,
Just a quick question.
I have recently created this mini grid game using the a char [10] [10]. I want to make it so that it reads from a file at the start of my game and load the values into the [10][10] char.
the actual file, info.dat will have all 100 chars on one line as i thought it would be easier to retrieve, so the file would look something like..
B EDF EGD JHD etc
the program must read and include the spaces into the 10*10 Char as well, so basically it just reads on char from the file then writes it to the first array then the second one and so on right until it's added all of the letters/spaces to the 10*10 char.
I've worked out most of the stuff I just need some help to fill in the gaps....
#include <fstream.h>
int disp[10][10]
ifsteam thefile;
int main()
{
thefile.open("info.dat");
//add a for statement that keeps going until it's read all 100 chars
//add another for statement to keep going until the end of the row then move to the next one.
thefile.close();
Any help would be greatly appreciated!
Thanks.
Regards,
Smithy.