I am using the following code to open a file in write mode:
FILE *pf = fopen("c:\\test.txt", "w");
if (NULL == pf)
{
printf("File pointer is NULL");
}
Sometime the file is created, and I get file pointer properly, but sometime I get the log "File pointer is NULL" even if the file is created on the C drive. How can I fix it?