Macro command TfReadLn

<< Click to Display Table of Contents >>

Navigation:  Macros > Macro commands and parameters > Macro input commands > Macro read from a text file >

Macro command TfReadLn

Purpose:

Read from one line of a text file and go to the next line

 

General notation:

TfReadLn( FileIndex, value1 [ , value2 [ , value3 ... ] ] )

 

The separator has been defined by TfOpenForRead and will be assumed present between the values.

The command TfReadLn reads the current line and jumps to the next input line.

If there are no data left to be read, the numerical variables will be filled with 0 and the text variables with an empty string.

 

Example:

 TfOpenForRead( 1, 'output.txt' )

 TfRead( 1, Textvariable )

 text( Textvariable )

 TfReadLn( 1, Numericalvariable1, Numericalvariable2, Numericalvariable3 )

 //        At this point the reading process continues on the next input line

 text( Numericalvariable1, ',', Numericalvariable2, ',', Numericalvariable3 )

 TfRead( 1, Textvariable )

 text( Textvariable )

 TfRead( 1, Numericalvariable1, Numericalvariable2, Numericalvariable3 )

 text( Numericalvariable1, ',', Numericalvariable2, ',', Numericalvariable3 )

 TfClose(1)

 

Using the data:

'one';2;3;4;five;6;  1.23

'one';2;3;4;five;6;  1.23

 

Results in:

'one'

2,3,4

'one'

2,3,4

 

See also:

TfOpenForRead

TfRead

TfReadLn

TfEOF

TfClose

 

Back to input commands.