V
vashwath
#include <stdio.h>
int main()
{
FILE *fp;
char s[100];
fopen("file.txt","w+");
fprintf(fp,"HI\n");
fclose(fp);
fscanf(fp,"%s",s);
printf("%s\n",s);
}
I know this will invoke undefined behaviour.Does undefined behavior
mean it MIGHT also work as expected in this case?Is it possible to read
from a file which already closed at least once out of 1000 times on
thousand different environment?
int main()
{
FILE *fp;
char s[100];
fopen("file.txt","w+");
fprintf(fp,"HI\n");
fclose(fp);
fscanf(fp,"%s",s);
printf("%s\n",s);
}
I know this will invoke undefined behaviour.Does undefined behavior
mean it MIGHT also work as expected in this case?Is it possible to read
from a file which already closed at least once out of 1000 times on
thousand different environment?