int _tmain (int arg c, _TCHAR * argv [])
{
/* Pointer to the file */
The FILE * fp1=NULL;
/* Character variable to read the content of the file */
char c;
/* Opening a file mode in r */
Fp1=fopen (" myfile. TXT ", "w");
/* Infinite loop - I have 2 break to last come out of the loop */
While (1)
{
C=fgetc (fp1);
If (EOF) c==
break;
The else
Printf (" % c ", c);
}
The fclose (fp1);
return 0;
}
After each debug this one line of code
fp1=fopen (" myfile. TXT ", "w");
File pointer fp1 shows "error pointer", why?
Is related to environmental variation, please help to look at,
Thank you, for many years not write programs on the vc, true don't understand, why such a problem,
CodePudding user response:
First to determine whether a file open success again for later operationMay not find the file, try to use absolute paths
CodePudding user response:
http://en.cppreference.com/w/cpp/io/c/fopenCodePudding user response:
Successful fopen call??CodePudding user response: