How to read the last lines of file?
#5

Well, dini saves stuff using 'keys', so just reset the keys for the last 3 reports with the correct report strings.
Btw, a method using the original file functions
pawn Code:
new
    File:Fp = fopen("irc_log.txt", io_read),
    thirdLastLine[256],
    secondLastLine[256],
    lastLine[256],
    idx = 0;

while (fread(Fp, lastLine) != 0) idx++;
fseek(Fp, 0, seek_start);

while (idx)
{
  switch (idx)
  {
    case 3: fread(Fp, thirdLastLine);
    case 2: fread(Fp, secondLastLine);
    default: fread(Fp, lastLine);
  }
  idx--;
}
fclose(Fp);
Reply


Messages In This Thread
How to read the last lines of file? - by SiJ - 26.04.2010, 12:50
Re: How to read the last lines of file? - by SiJ - 27.04.2010, 13:18
Re: How to read the last lines of file? - by [MWR]Blood - 27.04.2010, 13:20
Re: How to read the last lines of file? - by SiJ - 27.04.2010, 14:34
Re: How to read the last lines of file? - by dice7 - 27.04.2010, 14:55
Re: How to read the last lines of file? - by SiJ - 27.04.2010, 15:38

Forum Jump:


Users browsing this thread: 1 Guest(s)