Hi all,
I am a newbie to C programming world. In my program I want to log information into a log file whose file name should be filename_date_time
I am using following code to write information but need help in changing the file name from filename to filename_date_time.
#include <stdio.h>
#include<string.h>
int main()
{
/* declare a FILE pointer */
FILE *file;
/* open a text file for writing */
file = fopen("data/filename.log", "w");
fprintf(file, "I am the new file with date and time.");
fclose(file);
return 0;
}
Please help me to resolve this issue.
Thanks,
Scott.