SA-MP Forums Archive
Appending text - 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: Appending text (/showthread.php?tid=470660)



Appending text - papedo - 19.10.2013

Hello,

Is any way to user Fseek to add some at start of file without overwriting all in file?

With file
Quote:

Line1=SecondText
Line2=ThirdText
EndOfFile

I would like to do: "AddLineAtStartOfFile("Line0=FirstText")";
Quote:

Line0=FirstText
Line1=SecondText
Line2=ThirdText
EndOfFile

Any ideas how to do it?

-----

This script only ovewrite all

pawn Код:
new File:fileX = fopen(fname,io_readwrite);
fseek(fileX,0,seek_start);
fwrite(fileX,"Line0=FirstText\n");
fclose(fileX);



Re: Appending text - RajatPawar - 19.10.2013

EDIT: A sec
EDIT: fseek should work, let me look through! Sorry !


Re: Appending text - papedo - 19.10.2013

So I can do it only manually with rewriting all in file? OK

But what is FSeek used for when it canґt write at start of file?