Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

utextfile

Pascal unit for handling text files.

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

utextfile

Pascal unit for handling text files.

Usage

Writing to file code example:

pascal
tf := CTextFile.Create('testcreate.txt');
tf.OpenFileWrite();
Writeln('The status of ' + tf.GetPath + ' is ' + BoolToStr(tf.GetStatus, 'OPEN', 'CLOSED'));
tf.WriteToFile('test text');
tf.WriteToFile('test text2');
tf.CloseFile();

Reading from file code example:

pascal
tfr := CTextFile.Create('testread2.txt');
tfr.OpenFileRead();
Writeln('The status of ' + tfr.GetPath + ' is ' + BoolToStr(tfr.GetStatus, 'OPEN', 'CLOSED'));
repeat
   WriteLn(IntToStr(tfr.GetCurrentLine()) + ': ' + tfr.ReadFromFile());
until tfr.GetEof();
tfr.CloseFile();