<< Click to Display Table of Contents >> Navigation: Macros > Macro commands and parameters > Macro input commands > Macro read from a text file > Macro command TfRead |
Purpose:
Read from one line of a text file
General notation:
TfRead( FileIndex, value1 [ , value2 [ , value3 ... ] ] )
The separator has been defined by TfOpenForRead and will be assumed present between the values.
The command TfRead reads the current 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 )
TfRead( 1, Numericalvariable1, Numericalvariable2, Numericalvariable3 )
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
Results in:
'one'
2,3,4
five
6, 1.23,0
See also:
Back to input commands.