Posts: 2,593
Threads: 34
Joined: Dec 2007
fread(fh, str); reads only 1\r\n - one line
pawn Код:
new File:fh = fopen("text.txt",io_read);
new line;
while(fread(fh, str))
{
++line;
if(strfind(str,"2",true) != -1)
{
printf("succeed at line %d",line);
break; // stops the loop
}
else print("failed");
}
fclose(fh);
Posts: 47
Threads: 9
Joined: Jan 2013
Reputation:
0
look i have few strings, and it still dosent find them.
those strings:
ARTPEPEPEPE
ARTTTTTTTT
ARPEERERERR
i want it to recognize the second.
but it wont.
help?
Posts: 2,593
Threads: 34
Joined: Dec 2007
pawn Код:
new File:fh = fopen("text.txt",io_read);
new Found;
while(fread(fh, str))
if(strfind(str,"2",true) != -1)
{
Found = 1;
break; // stops the loop
}
fclose(fh);
return Found; // returns 0 if not found or 1 if match