How to get number of lines in 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to get number of lines in text file? (
/showthread.php?tid=234375)
How to get number of lines in text file? -
NiXeL - 03.03.2011
Hi there, i'm looking for someone to help me with this. I have a text file and I need to count number of lines in it. How do I do it?
Thanks
Re: How to get number of lines in text file? -
NiXeL - 03.03.2011
oh, nevermind. I've just turned my brains on and think and that what I get, it works fine for me. Hope it's will be helpful for you.
Код:
new string[64], count = 0;
new File:file = fopen("houses.txt", io_read);
while(fread(file, string)) {
count++;
}
fclose(file);
Re: How to get number of lines in text file? -
jamesbond007 - 03.03.2011
kruto...=)))
Re: How to get number of lines in text file? -
Mean - 03.03.2011
Quote:
Originally Posted by NiXeL
oh, nevermind. I've just turned my brains on and think and that what I get, it works fine for me. Hope it's will be helpful for you.
Код:
new string[64], count = 0;
new File:file = fopen("houses.txt", io_read);
while(fread(file, string)) {
count++;
}
fclose(file);
|
You just gave me an idea, thanks...