Hi there,
Firstly i hope this is the right board to post on, secondly apologies as im not an experianced programmer so may appear a little ignorant!
Ive written a 2D type sprite game in visual c++ in microsoft visual studio .NET which works fine within the Debug menu. Howerver i get my error when i try and run the .exe made for my game.
heres the error message
Code:
Debug Assertion Failed!
program: basejoystick.exe
File: fgets.c
Line: 60
Expression: str !=NULL
So my first error is due to not opening the file correctly i think, which gives me an error with the fgets function in my code. I worked this out by putting in the message box which tells me the target file isnt loaded.
Code:
char TheTargetFileNumber[15];
char c = '\n';
char fileInfo[50];
char filename[50];
strcpy(filename, "static_data1.csv"); //write the string of the filename to char filename
staticData_f = fopen(filename, "r"); // open the file here
if(staticData_f == NULL)
{ MessageBox( NULL, TEXT("target file tracker.\n")\ TEXT("not found\n")\
TEXT("."),
TEXT("."), MB_ICONINFORMATION | MB_OK );
return FALSE;
} // this message box will tell me if file not found
fgets(fileInfo, sizeof(fileInfo), staticData_f);
sscanf(fileInfo, "%15s", &TheTargetFileNumber);
fclose(staticData_f);
in my file static_data1.csv i have this string
I have my static_data1.csv file in the same directory as other files im opening and closing fine.
I would be greatfull if anyone could help me!! In other parts of my programe i open and close files in the same way with no problems?
Many thanks,
ANDY