|
The QMReadSeq() function reads a line of text from a sequential file. It is analogous to the QMBasic READSEQ statement.
The function arguments are:
| FileNo | is the file number returned by a previous QMOpenSeq() call. |
| Err | is an integer variable to receive status information. This argument is not present in all variants of the QMClient API. |
The QMReadSeq() function requests the server to return the next line of text from the file opened as FileNo.
If successful, the function returns the data, excluding the line terminator.
The example program fragments below open a sequential item named STOCK in the IMPORT file, read the first line of text and then closes the file. A real program should test the error status from the read to determine if the action was successful.
char * QMReadSeq(int FileNo, int * Err)
fData = QMOpenSeq("IMPORT", "STOCK", 0);
Rec = QMReadSeq(fData, &Err);
QMFree(Rec);
QMClose(fData);
The returned pointer references a dynamically allocated memory area that must be released using QMFree() when no longer needed. Note that attempting to read beyond the end of the file returns a pointer to a null string, not a NULL pointer.
|
QMReadSeq(ByVal FileNo as Integer, ByRef Err as Integer) as String
fData = QMOpenSeq("IMPORT", "STOCK", 0)
Rec = QMReadSeq(fData, Err)
QMClose(fData)
|
ReadSeq(FileNo, Err)
fData = session->OpenSeq("IMPORT", "STOCK", 0)
Rec = session->ReadSeq(fData, Err)
session->Close(fData)
|
String ReadSeq(int FileNo)
fData = qm.OpenSeq("IMPORT", "STOCK", 0);
Rec = qm.ReadSeq(fData, &Err);
If successful, the ServerError property will be set to SV$OK. Other values indicate an error.
|
ReadSeq(FileNo)
fData = qm.OpenSeq("IMPORT", "STOCK", 0)
Rec, Err = qm.ReadSeq(fData)
|
See also:
QMOpenSeq(), QMReadBlk(), QMSeek(), QMWeofSeq(), QMWriteBlk(), QMWriteSeq()
|