Reading last 10 lines in a .txt file
#11

pawn Код:
new File:rflh = fopen("reports.txt", io_read);
if(rflh)
{
    new lines, id, str[256];
    while(fread(rflh, str))
    {
        lines++;
    }
    id = lines - 10;
    lines = 0;
    fseek(rflh);
    while(fread(rflh, str))
    {
        if(++lines <= id) continue;
        SendClientMessage(playerid, -1, str);
    }
    fclose(rflh);
}
Reply


Messages In This Thread
Reading last 10 lines in a .txt file - by GameOvr - 27.10.2018, 18:17
Re: Reading last 10 lines in a .txt file - by Jefff - 27.10.2018, 19:34
Re: Reading last 10 lines in a .txt file - by NaS - 27.10.2018, 20:36
Re: Reading last 10 lines in a .txt file - by solstice_ - 27.10.2018, 21:35
Re: Reading last 10 lines in a .txt file - by TheToretto - 27.10.2018, 22:12
Re: Reading last 10 lines in a .txt file - by GameOvr - 28.10.2018, 05:42
Re: Reading last 10 lines in a .txt file - by GTLS - 28.10.2018, 06:54
Re: Reading last 10 lines in a .txt file - by GameOvr - 28.10.2018, 10:12
Re: Reading last 10 lines in a .txt file - by GangstaSunny. - 28.10.2018, 11:34
Re: Reading last 10 lines in a .txt file - by v1k1nG - 28.10.2018, 11:49
Re: Reading last 10 lines in a .txt file - by ReD_HunTeR - 28.10.2018, 12:54
Re: Reading last 10 lines in a .txt file - by GameOvr - 28.10.2018, 16:14
Re: Reading last 10 lines in a .txt file - by Infin1ty - 28.10.2018, 18:48
Re: Reading last 10 lines in a .txt file - by GTLS - 30.10.2018, 16:27

Forum Jump:


Users browsing this thread: 1 Guest(s)