chasep255
chasep255

Reputation: 12185

fopen in C wont create file

FILE * f = fopen("c:\\out.txt", "wb");
if(f == NULL)
     printf("ERR");

This code prints ERR. c:\out.txt does not yet exist. However if I create an empty file called out.txt and then place in the c:\ the code executes fine. How do I make c create a file if it does not exist?

Upvotes: 0

Views: 855

Answers (1)

chasep255
chasep255

Reputation: 12185

I fixed the problem by running Netbeans with administrator privileges. This caused the exe to also be run as administrator so now I can write to c:.

Upvotes: 2

Related Questions