Last 10 .txt
#2

pawn Код:
new lines;
while(fread(string, FILE))
{
  lines++;
}
printf("File has %d lines", lines);

new max_lines = lines;
lines = 0;
while(lines < max_lines - 10)
{
  fread(string, FILE); //moving the pointer a line down until its on the 10th line from the back
  lines++;
}

while(max_lines >= lines)
{
  fread(string, FILE); //reading the last 10 lines
  printf("Reading line %d", lines);
  lines++;
}
Reply


Messages In This Thread
Last 10 .txt - by gecatahh - 19.01.2010, 16:25
Re: Last 10 .txt - by dice7 - 19.01.2010, 16:35
Re: Last 10 .txt - by gecatahh - 19.01.2010, 16:41
Re: Last 10 .txt - by gecatahh - 19.01.2010, 17:04
Re: Last 10 .txt - by FakerBG - 19.01.2010, 19:00
Re: Last 10 .txt - by gecatahh - 21.01.2010, 19:40
Re: Last 10 .txt - by MadeMan - 21.01.2010, 19:52
Re: Last 10 .txt - by gecatahh - 21.01.2010, 23:23

Forum Jump:


Users browsing this thread: 3 Guest(s)