Official Content

Reads the following record (line) of a delimited text file. A line is defined as a sequence of characters followed by a line feed ("\n"), a carriage return ("\r"), or a carriage return immediately followed by a line feed ("\r\n"). The string that is returned does not contain the terminating carriage return or line feed.

Syntax

DFRNext()

Type Returned: 
Numeric

Scope

Objects: Procedure, Transaction, Web PanelData Provider
Generators: .NET, .NET Framework, Java, Ruby (up to GeneXus X Evolution 3)

Values

This function may return some of the following values:

Value Result Description
0 Successful operation. The record has been read.
-1 Wrong sequence. It occurs when this function is called before calling the dfropen function, or when this call returned a value other than zero (error).
-3 Reading error. It occurs when an error has occurred when reading a line of the delimited ASCII file.  The cause may be clearly identified, enabling the trace and looking for the message with code ADF0002.
-4 End of data.  

Samples

For this example, the parameter field separator is not required.

&Text = ""
&i = DFRopen( "Test.txt",1024,,"")
If &I = 0
    Do while DFRnext( ) = 0
       &i = DFRgtxt(&Linetxt) // The length of the line is given by the size of the variable.
       &Text = &Text + Newline() + &Linetxt
    EndDo
    &i = DFRclose( )
else
    &Text = "Could not open file"
EndIf

See Also

Delimited ASCII files functions




Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant