+ 7
How to read from a specific file using a pointer to that file?
I am trying to read from .txt file using a pointer diff to file, FILE* diff = NULL; diff = fopen("file.txt", "r"); But it shows me that fopen maybe unsafe, I changed it to fopen_s (as recommended) and now I have 3 more errors : ' a value of type "errno_t" cannot be assigned to an entity of type "FILE*" ' ' argument of type "const char*" is incompatible with parameter of type "FILE*" ' ' too few arguments in function call' How to fix this?
2 Réponses
+ 2
here is the snippet of code :
FILE *fp;
fopen_s(&fp, "testFile.txt", "r+");
fclose(fp);
+ 7
Thanks! Now it works perfectly!