I am using Visual Studio 2005 (C \ C ++).
I pass the string to the function as a char array. I want to open the file passed as a parameter and use it. I know that my code works to some extent, because if I hardcode the file name as the first parameter, it works fine.
I notice that if you look at the value as an hour, the value includes the address in the direction of the string literal. I tried passing the file name as a pointer, but then it complains about type conversion using __w64. As I said, it works fine with "filename.txt" instead of fileName. I'm at a dead end.
void read(char fileName[50],int destArray[MAX_R][MAX_C],int demSize[2])
{
int rows=0;
int cols=0;
int row=0;
int col=0;
FILE * f = fopen(fileName,"r");
...
Caller Function Code:
char in_filename[50];
int dem[MAX_R][MAX_C];
int dem_size[2];
get_user_input( in_filename);
read(in_filename, dem, dem_size );
In the watch that I added for the file name, the correct text appears, so the data is transferred.