Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 09-16-2009, 04:25 PM
FreakaZoid2 FreakaZoid2 is offline
Senior Member
 
Join Date: Jul 2009
Posts: 137
Default filestream large text file

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.
Reply With Quote
  #2  
Old 09-16-2009, 04:57 PM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 4,764
Default

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
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 11:38 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.