reading from file

Started by
2 comments, last by raptorstrike 19 years, 5 months ago
i want to have an 2d array: map[100][100]; and a file that contains something like: 0123456789 ---------- 0 |11121102101010210210102 1 |11121102101010210210102 2 |11121102101010210210102 3 |11121102101010210210102 4 |11121102101010210210102 then i want to put that in the array... so map[0][0] == 1, map[7][0] == 2 can someone help me?
Advertisement
When dereferencing, first bracket is row second column. I think you should know the rest
______________________________Madman
You have to open (in binary) file that contains your map definition and load that thing into memory - probably you have problems with file handling...?
ok well with this case i dont see whats wrong with just your run of the mill ifstream to read in the file then if you really need to you can just take the string and divide it into sections like so

string[Y] FileReader = //read file in here
if(X = 10)
{
Y++;
};
//also there is a function that will then that array of string"int" into actual ints then you could put those in an array and your set

ok im not in a place were i have the documintation for this set of functions (file reading) on hand but thats the genral idea so if some one could elaborate a little more on what i wrote i would appriciate it (that is if this is what he is looking for)
____________________________"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie

This topic is closed to new replies.

Advertisement