I'm trying to create a program that creates a log file and enters in information.
I created the following function to just create the file. However, whenever I run it, the program results in an error. When I put the file name directly in the fopen command and comment everything else, it works fine. The variable "Drive" that I send is either "C" or "D".
Code:void BuildLogFile(char *drive) { // Build path to log char logFileName[] =""; strcpy(logFileName, drive); strcat(logFileName, ":\\Test\\ppbatch_3.log"); fpLogFile = fopen(logFileName,"w"); fclose(fpLogFile); }