Reading from different lines in one text 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)
+--- Thread: Reading from different lines in one text file (
/showthread.php?tid=338847)
Reading from different lines in one text file -
mave_man - 01.05.2012
Hello.
I want to read the messages for my 'autobot' (= some sort of chatbot that displays random lines of text)
I know howto make it read from different files with one line of text in every file.
But I was wondering if I could make one file with all the lines of text in it somehow?
Please every suggestion/help is welcome!
Re: Reading from different lines in one text file -
TzAkS. - 01.05.2012
I don`t understand what you wan`t to say.
If i am not wrong,you can do something like
Save it to the file like this
Код:
message1 = " Message1 here"
message2 = " Message2 here"
message3 = " Message3 here"
message4 = " Message4 here"
And then you can read it with
message1...
AW: Reading from different lines in one text file -
BigETI - 01.05.2012
If you want to read the lines of a whole file you have to do something like
pawn Код:
while(fread(file, buffer))
{
//Reads line by line
}