SA-MP Forums Archive
Question about Fopen, Fwrite and Fclose - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Question about Fopen, Fwrite and Fclose (/showthread.php?tid=321966)



Question about Fopen, Fwrite and Fclose - milanosie - 29.02.2012

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


Re: Question about Fopen, Fwrite and Fclose - Babul - 29.02.2012

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..


Re: Question about Fopen, Fwrite and Fclose - Sinner - 29.02.2012

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.


Re: Question about Fopen, Fwrite and Fclose - Vince - 29.02.2012

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.