![]() |
|
#1
|
|||
|
|||
|
i have this very large text file (log entries) that i need to process basically a line at a time. each line varies in length (9-147+ characters). i am using a filestream to read the file but when i set the buffer size to a number (150) it is reading some of the other lines of characters (wrapping if you will). since i need to evaluate each line from the log file it is causing me some problems.
i have found many examples of using the filestream but nothing i have found seems to explain how to only read a line at a time. |
|
#2
|
|||
|
|||
|
Do not use FileStream. Use normal text file I/O procedures like "Readln" function. Example:
Code:
var
sBuffer : String;
fHandle : TextFile;
begin
AssignFile(fHandle,'C:\MyData.txt');
Reset(fHandle);
//Repeat for each line until end of file
repeat
//Read line by line
Readln(fHandle, sBuffer);
//Show each line or process it.
Showmessage( sBuffer );
until Eof(fHandle);
//Finally close the file.
CloseFile(fHandle);
__________________
Regards, Abdulaziz Jasser |
![]() |
| Thread Tools | |
| Display Modes | |
|
|