Dark-Core
Dark-Core

Reputation: 17

fprintf not working when runned by another application

i have a C console application that write a text to a file:

 FILE *f;
 f = fopen("out", "w");
 fprintf(f, "%s","My Text");
 rewind(f);
 fclose(f);

when i run it from explorer it works fine, but when i run it using another application the file does not create and the text not saved

even with the administrator rights

can any one help me ?

Upvotes: 0

Views: 95

Answers (1)

Michał Góral
Michał Góral

Reputation: 1517

Your out file is a relative path and it may be set e.g. to your third-party application directory. Or maybe it changes its current directory to something else and it results your app saving out there? If you're not sure, you can always try to pass absolute path to your out file.

Upvotes: 1

Related Questions