- Code: Select all
FILE* LEVEL = fopen("Level1.lev", "r");
int World[10][10] = {LEVEL};
When I try to run this, I get an error. Can anyone help me?
FILE* LEVEL = fopen("Level1.lev", "r");
int World[10][10] = {LEVEL};
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 0, 0, 0, 0, 2, 0, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1
map_read (char* file_name, int world[][10])
{
FILE* file = fopen(file_name, "r");
int i, j;
if(file!=NULL)
{
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
fscanf(file, "%d, ", &world[i][j]);
}
}
}
}
Users browsing this forum: No registered users and 1 guest