Hello! I'm working on this roguelike and I'm trying to make it so that the different "maps" can be loaded from text files. It was going pretty good until I tried to get it to return the filled array. Take a look:
void getMap(string str[10][10]){
ifstream myfile("world1.txt");
int a = 0;
int b = 0;
while(!myfile.eof())
{
getline(myfile,str[a][b],' ');
if(a ==9)
{
a=0;
++b;
getline(myfile,str[a][b],' ');
}
a++;
}
}
int main(){
string map[10][10];
getMap(&map);
system("PAUSE");
return 0;
}
So I'm trying to copy the completed array "str" at the end of function "getMap" into array "map". I would've thought this code would work, but when I try to compile I get "error C2664: 'getMap' : cannot convert parameter 1 from 'std::string (*)[10][10]' to 'std::string [][10]'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast"
Any suggestions?