SA-MP Forums Archive
Reading text from a 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: Reading text from a file (/showthread.php?tid=256417)



Reading text from a file - Sascha - 20.05.2011

Hi guys... this question seems to be a bit noobish or w/e however I don't work that much with text files (most often mysql and stuff), so I don't really know about it...

I want to add a list with names into a file called "names"
now I want to create a function that returns true or false (depends if the name was found in the list or not)...

to do that I need to split the text of the file into an array, seperated by the line breaks (\r\n)...

now my question is: how do I split each line into an array...
e.g.
new list[][] =
{
"Joe", "Mike", "Charlie", "Chris"
};

would be my array without the file...

I hope you understand what I mean^^


Re: Reading text from a file - Sascha - 22.05.2011

bump