[fpc-pascal] read lines at end of file

2011-04-11 Thread John Lee
Need to read the last 4 lines (txt) of a very large log file 100M bytes, 100k lines or more lots of times - of course I can read through the file in the normal way but this is rather slow. Is there a way to 'read lines from the end'? I note that unix tail or its port to windows does this very fast

Re: [fpc-pascal] read lines at end of file

2011-04-11 Thread José Mejuto
Hello FPC-Pascal, Monday, April 11, 2011, 6:32:20 PM, you wrote: JL> Need to read the last 4 lines (txt) of a very large log file 100M bytes, JL> 100k lines or more lots of times - of course I can read through the file in JL> the normal way but this is rather slow. Is there a way to 'read lines

Re: [fpc-pascal] read lines at end of file

2011-04-11 Thread Mattias Gaertner
On Mon, 11 Apr 2011 19:45:10 +0200 José Mejuto wrote: > Hello FPC-Pascal, > > Monday, April 11, 2011, 6:32:20 PM, you wrote: > > JL> Need to read the last 4 lines (txt) of a very large log file 100M bytes, > JL> 100k lines or more lots of times - of course I can read through the file > in > J

Re[2]: [fpc-pascal] read lines at end of file

2011-04-11 Thread José Mejuto
Hello FPC-Pascal, Monday, April 11, 2011, 7:55:01 PM, you wrote: >> The idea is easy, instead reading forward, you read backwards in >> blocks of, say, 64 Kb and count lines back. If not enougth lines you >> insert another 64 Kb before and so on. Average line is usually less >> than 100 bytes, so

[fpc-pascal] generic, specialize keywords in mode delphi in FPC trunk

2011-04-11 Thread cobines
Hello. Following program: program a; {$mode delphi} type generic TGen = class end; TSpc = specialize TGen; begin end. compiles with FPC 2.4.2, but not with 2.5.1 rev. 17306: a.pas(4,11) Fatal: Syntax error, "=" expected but "identifier TGEN" found a.pas(5,21) Error: Identifier not found "sp

Re: [fpc-pascal] generic, specialize keywords in mode delphi in FPC trunk

2011-04-11 Thread Paul Ishenin
12.04.2011 4:22, cobines wrote: Hello. Following program: program a; {$mode delphi} type generic TGen = class end; TSpc = specialize TGen; begin end. compiles with FPC 2.4.2, but not with 2.5.1 rev. 17306: a.pas(4,11) Fatal: Syntax error, "=" expected but "identifier TGEN" found a.pas(

[fpc-pascal] Re: generic, specialize keywords in mode delphi in FPC trunk

2011-04-11 Thread leledumbo
Since FPC in Delphi mode supports Delphi style generics syntax, FPC's own generics syntax was removed from this mode. You can still use it from ObjFPC mode. -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/generic-specialize-keywords-in-mode-delphi-in-FPC-trunk-tp

Re: [fpc-pascal] generic, specialize keywords in mode delphi in FPC trunk

2011-04-11 Thread cobines
2011/4/12 Paul Ishenin : > 12.04.2011 4:22, cobines wrote: >> >> Hello. >> >> Following program: >> >> program a; >> {$mode delphi} >> type >>   generic TGen  = class end; >>   TSpc = specialize TGen; >> begin >> end. >> >> compiles with FPC 2.4.2, but not with 2.5.1 rev. 17306: >> >> a.pas(4,11) F

Re: Re[2]: [fpc-pascal] read lines at end of file

2011-04-11 Thread johnelee1944
So the idea is to open file eg as file of array [1:65536] of char or something similar, seek & read to end of file, then go through the last array converting to strings by finding crlfs correct? Is this the simplest way? If not any outline code? John On , José Mejuto wrote: Hello FPC-Pas

Re: [fpc-pascal] read lines at end of file

2011-04-11 Thread Robert Wolfe
On 04/11/2011 12:32 PM, John Lee wrote: Need to read the last 4 lines (txt) of a very large log file 100M bytes, 100k lines or more lots of times - of course I can read through the file in the normal way but this is rather slow. Is there a way to 'read lines from the end'? I note that unix tai