SA-MP Forums Archive
fwrite - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: fwrite (/showthread.php?tid=188186)



fwrite - Mike Garber - 06.11.2010

When I try to write with fwrite to a file, It just replaces what I've previously written, why?


Re: fwrite - DeathOnaStick - 06.11.2010

Quote:
Originally Posted by Mike Garber
Посмотреть сообщение
When I try to write with fwrite to a file, It just replaces what I've previously written, why?
Because this is what fwrite does. Use fread to read the file into a string, use format (like format(....,"%s\n%s, FileContent, StringToStoreInFile) ) and then use fwrite. It will replace the text that was in the file, with the stuff you've read from the file and the String you want to store in the file.


Re: fwrite - Mike Garber - 06.11.2010

That will create a huge ass string since I'm gonna log with fwrite? or Is there any better way to log stuff with?


Re: fwrite - Mike_Peterson - 06.11.2010

djson or dini?


Re: fwrite - DeathOnaStick - 06.11.2010

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
djson or dini?
You could modify dracoblues dini include (dini_Set). You can remove all those "key[]"-stuff from the function, cuz you dont need the keys, because you just want to log with it, if i understoof correctly.


Re: fwrite - Mike Garber - 06.11.2010

Quote:
Originally Posted by DeathOnaStick
Посмотреть сообщение
You could modify dracoblues dini include (dini_Set). You can remove all those "key[]"-stuff from the function, cuz you dont need the keys, because you just want to log with it, if i understoof correctly.
Yeah well I am going to use dini for other stuff :P


Re: fwrite - LarzI - 06.11.2010

Quote:
Originally Posted by Mike Garber
Посмотреть сообщение
When I try to write with fwrite to a file, It just replaces what I've previously written, why?
io_write or io_append?

Use io_append if you want to append, not replace text.


Re: fwrite - Mike Garber - 06.11.2010

Quote:
Originally Posted by LarzI
Посмотреть сообщение
io_write or io_append?

Use io_append if you want to append, not replace text.
Thank you very much