SA-MP Forums Archive
fwrite writes only 1 line - 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: fwrite writes only 1 line (/showthread.php?tid=445198)



fwrite writes only 1 line - pasha97 - 20.06.2013

To be honest, i have never used fwrite, I always used dini. But now I need to use it. And what I see: Every time we write anything to the file, new line replaces all the previous file content

pawn Code:
format(stringu,sizeof(stringu),"%s/%s/%f/%f/%f/%d\r\n",name,pname,x,y,z,world);
if(buildingsFile)
{
fwrite(buildingsFile,stringu);
.............
So fwrite doesnt write the string to the next line. It erases the file, and then writes the string to it.


AW: fwrite writes only 1 line - BigETI - 20.06.2013

Please show me how do you open your file.


Re: fwrite writes only 1 line - IceBilizard - 20.06.2013

io_write writes every time new line from top so if you need to write more then one line use

io_append

You can visit here and see file functions
https://sampwiki.blast.hk/wiki/File_Functions


Re: fwrite writes only 1 line - SwisherSweet - 20.06.2013

[code]
format(stringu,sizeof(stringu),"%s %s %f %f %f %d\r\n",name,pname,x,y,z,world);
[/code