AuthorMessage
NeiSep
Ametuar
Posts: 93

well i got problem to reach a certen text in a file lets say i got file with 500 rows.
And i got the text Hello World in Row 50 how do i get it out of those lines?
I just dont get how to get out text from a textfile from a special line anyone know?
have read about it and test and test and test but i cant come up with a solution.
Have a nice day
bluebear
n00b
Posts: 32

Quoted from NeiSep
well i got problem to reach a certen text in a file lets say i got file with 500 rows.
And i got the text Hello World in Row 50 how do i get it out of those lines?
I just dont get how to get out text from a textfile from a special line anyone know?
have read about it and test and test and test but i cant come up with a solution.
Have a nice day

Delphi must support some seek line function, or maybe you also need to locate where in the text file the line is located.. But i'm 100% sure there are examples for that. Google is your friend.
NeiSep
Ametuar
Posts: 93

seems to me google dont like me that much 
anyway i tried several ways but i finly got it to work hehe.
Mickey
Ametuar
Posts: 115

In Pascal if you use a text file you cannot use seek. You have to start from beginning and read each line sequentially when you reach the desired line you can stop.
In a text file you may have different length of rows.
If your texts are same length you can use a typed file then you can use seek to point to 50th
There is a typed file example:
Code:
type
  MyPrivateType = record
    MyText: string[20];
  end;
  MyFile  = file of MyPrivateType;
...
  Seek(f, 50);
...