I am just trying to open and write something in file but when visual studio tries to execute fprintf program crashes here is my code
#include<stdlib.h>
int main()
{
    FILE* fPointer;
    fPointer = fopen_s(&fPointer,"C:\\asd.txt","w");
    fprintf(fPointer, "If ı can read this then ı can create for loop");
    fclose(fPointer);
    return 0;
}
here is the error message : 
Access violation writing location 0x0000003A.
fopen_s return value is an error number and you overwrite your file pointer with that which you should not do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With