I'm trying to create a log file for each program execution.
char * createLogFile(char *filename) {
char path[100] = "logs_folder/";
char text[100] = "";
strcpy(text, filename);
strcat(path, text);
strcat(path, ".txt");
FILE *logFile;
logFile = fopen(path, "w");
fclose(logFile);
return text;
}
The problemm comes when I'm debugging this code piece, logFile is always null. And the program crashesh when it reaches fclose()
it takes me to this line of invalid_parameter.cpp:
if (IsProcessorFeaturePresent(PF_FASTFAIL_AVAILABLE))
{
__fastfail(FAST_FAIL_INVALID_ARG);
}
The path is correct, why isn't the file creating? Why does it crash?