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



Reading all lines from a file - Striker_Moe - 18.12.2009

Hi there.

Iґve got a file - it looks like this:

------------------------------------
email@email.com
mail@email.com
ohai@email.com
... and so on.
------------------------------------

Now Iґd like to read every single line from this file and do something with it ( Mail(); ). How can I do this?


Re: Reading all lines from a file - Striker_Moe - 18.12.2009

Sorry forgot, Iґm just using the default read/write functions, no dini or smth.


Re: Reading all lines from a file - dice7 - 18.12.2009

https://sampwiki.blast.hk/wiki/File_Functions


Re: Reading all lines from a file - Striker_Moe - 18.12.2009

Thanks for replying, but I cant find anything helping me with this problem in there.


Re: Reading all lines from a file - dice7 - 18.12.2009

https://sampwiki.blast.hk/wiki/Fopen
https://sampwiki.blast.hk/wiki/Scripting...ions_Old#fread

pawn Код:
new File:handler=fopen("file.txt", io_read);
  new string[256], MyVal[256], idx;
  while(fread(handler, string))
  {
    printf("Line %d contains the following text: %s", idx+1, string);
  }