CsvFileInputRecordStream.ReadRecordTo

Syntax

CsvFileInputRecordStream.ReadRecordTo( context, record)

Return Value

Long

Returns 0 if a record was successfully read. Returns -1 if end of file was encountered before reading a record. Returns 1 if the end of a table was encountered before reading a record.

Purpose

Read the next record from this stream. Implements InputRecordStream.ReadRecordTo .

Remarks

CsvFileInputRecordStream is designed to work with CSV files that may contain multiple tables. Strictly speaking, such files are not compliant with RFC 4180, but many common spreadsheet applications support them regardless.

If CsvFileInputRecordStream.ReadRecordTo encounters an empty line or a line with nothing but separator characters, it returns 1 to indicate it has reached the end of the current table. CsvFileInputRecordStream.ReadRecordTo returns -1 to indicate it has reached the end of the underlying file.

Note CsvFileInputRecordStream considers only empty lines and lines that contain nothing but separators as end-of-table markers. Lines containing whitepaces are not interpreted as end of table. A record consisting of nothing but empty strings can be represented by surrounding the empty strings with quotes. Such a record is read normally and not interpreted as end of table.

Applications that only need to read the current table do not have to be aware of end-of-table vs end-of-file distinction, as InputRecordStream.ReadRecordTo defines end of file to be any non-zero return value. However, applications that are aware they are reading a CsvFileInputRecordStream can distinguish between having reached the end of the current table and the actual end of the file by checking if the return value is +1 or -1 .

Parameters

context As SequenceContext

[In] Specifies the SequenceContext against which to evaluate the lookup strings specified by the record parameter. Refer to InputRecordStream.ReadRecordTo for more information.

record As String Array

[In/Out] An array of lookup strings specifying where to store the fields from the incoming record. The lookup strings are evaluated relative to the SequenceContext specified by the context parameter. Refer to InputRecordStream.ReadRecordTo for more information.

See Also

InputRecordStream.ReadRecordTo

CsvFileInputRecordStream.ReadRecord