well, I know this is pretty fundmental but I'm getting debug assertion errors and I don't understand why.
The user enters a file name, I use getline to extract it.. then in my read file fuction , to which I've passed a pointer to the filename, I call it. Sounds simple but I can't seem to get it. Please help.
Here is what I did:
cout<< "Please enter the name of the maze file you want to read, or (q) to quit.\n" << endl;
cout<< "(a) maze1.txt\n(b) maze2.txt\n(c) maze3.txt\n"<< endl;
cin.getline (filename, 10);
void Read_file (char m_array, int *columns, int *rows, Curr_pos &start, char *filename)
int a = 0;
int b = 0;
int f = 0;
pfilename = filename;
FILE *inp; //A pointer to the input file.
// FILE *outp; // A pointer to the output file.
inp = fopen("pfilename","r"); // Opens the input file.
// outp = fopen("copy.txt","w"); // Writes into an output file.
fscanf(inp,"%d %d", rows, columns); ** this is where the problem is.The rest of the code actually works fine. I'm pretty certain of that.
for ( a = 0; a < *rows; a++)
for ( b = 0; b < *columns; b++)
} while ( temp ==' ' || temp =='\n');
m_array[a][b] = temp;
if ( m_array[a][b] == 'E')
printf("Then coordinates for the entrance are: %d,%d\n", a,b);
start.row = a;
start.col = b;
if (m_array[a][b] == 'X')
printf ("The coordinates for the exit are: %d,%d\n", a, b);