SA-MP Forums Archive
Count strings in 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)
+--- Thread: Count strings in a file (/showthread.php?tid=672019)



Count strings in a file - KehmoSabeh - 23.01.2020

Hey, i don't know how to count strings in a text file, i need to get the number to use it in a loop. If some of you can help me i'd be thankful :3


Re: Count strings in a file - Markski - 23.01.2020

How're you separating strings? If you're separating them one on each line, maybe you can just count the lines

HTML Code:
new string[64], count = 0;
new File:file = fopen("houses.txt", io_read);
while(fread(file, string)) {
	count++;
}
fclose(file);



Re: Count strings in a file - KehmoSabeh - 25.01.2020

I didn't read well fread function before posting xD, thanks anyway