SA-MP Forums Archive
Showing last lines of file.. - 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: Showing last lines of file.. (/showthread.php?tid=122395)



Showing last lines of file.. - SiJ - 21.01.2010

Hey,
I've got a file which looks like this:
Quote:

A long string here
Another long string here
This string is also long
Something more
Long String here
A long string here

How can I get 3 last lines of this into separate arrays?
Like
str1[512] would be "Something more"
str2[512] would be "Long String here"
str3[512] would be "A long string here"



Re: Showing last lines of file.. - SiJ - 22.01.2010

Up to the space..


Re: Showing last lines of file.. - SiJ - 23.01.2010

Still unsolved..


Re: Showing last lines of file.. - llama - 23.01.2010

Using sa-mp's file functions I believe you can use the \n escape codes, so to read line 2 of the file \n%s, to read line 3 \n\n%s.

More info can be found here: https://sampwiki.blast.hk/wiki/File_Functions


Re: Showing last lines of file.. - SiJ - 23.01.2010

Tried.. But I couldn't make it read the 3 LAST lines of the file.. any help?


Re: Showing last lines of file.. - ¤Adas¤ - 23.01.2010

Post here your file reading code.


Re: Showing last lines of file.. - SiJ - 23.01.2010

Quote:
Originally Posted by ¤Adas¤
Post here your file reading code.
Already removed it from my script O.O


Re: Showing last lines of file.. - SiJ - 25.01.2010

Hello.. Still hoping u can help me guys (or maybe girls?)


Re: Showing last lines of file.. - mansonh - 25.01.2010

Quote:
Originally Posted by ¤Adas¤
Post here your file reading code.



Re: Showing last lines of file.. - SiJ - 25.01.2010

Quote:
Originally Posted by SiJ
Quote:
Originally Posted by ¤Adas¤
Post here your file reading code.
Already removed it from my script O.O