Question about Fopen, Fwrite and Fclose
#1

so actually, the question is pretty simple.

Let's say I have my file "scriptfiles/realityrp/logs/cmdlog.txt".
I want to write to that file,

Is it:
pawn Код:
new File:cmlog = fopen("realityrp/logs/cmdlog.txt", io_write); // Open the file
or is it:
pawn Код:
new File:cmlog = fopen("scriptfiles/realityrp/logs/cmdlog.txt", io_write); // Open the file

thanks
Reply
#2

its the first variant, the native file functions already take place in "scriptfils/" already. using the Directroy2- or FileManager-plugin, you may transfer files to other directories btw..
Reply
#3

Scriptfiles is the root directory, furthermore it's not possible to read or write to files outside that folder (except with the filemanager plugin). The first one is correct.
Reply
#4

And in your case you'd probably want to use io_append as well, io_write overwrites all the content that's currently in the file.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)