QMOpenSeq()

QMOpenSeq()

Top  Previous  Next

 

The QMOpenSeq() function opens a sequential file. It is analogous to the QMBasic OPENSEQ statement.

 

The function arguments are:

 

FileNameis the VOC name of the file to be opened.

 

Idis the record name within FileName of the item to be opened. If given as a null string, FileName must be the pathname of the item to be opened.

 

Modesis an additive value specifying the manner in which the file is to be opened:
0x0002Return status value ER$LOCKED if locked by another user. If this mode is not present, the operation waits for the lock to be cleared.
0x0010Open in read-only mode.
0x0100Open in append mode.
0x0200Open in overwrite mode, replacing existing content.
0x0400Unbuffered mode.
0x1000Open in shared mode.

 

 

The returned integer value is the file number which must be used in all subsequent operations against this file. If the file cannot be opened, the function returns zero. The QMStatus() function can be used to retrieve the error cause.

 

If the item does not exist, QMOpenSeq() returns a valid file number and the item will be created by subsequent use of any function that writes to the file.

 

There is no practical limit to the number of files that can be open at one time.

 
The file should be closed using QMClose().

 

The examples below open a sequential file in the directory identified by VOC item REPORTS using the value in DATE as the record name. The modes value is given in hexadecimal form as the additive value that combines return of an error code if the item is locked and selection of overwrite mode. This could alternatively have been written as the decimal value 514.

 

 

hmtoggle_plus1C

 

hmtoggle_plus1VB.Net

 

hmtoggle_plus1QMBasic Class Module

 

hmtoggle_plus1Java

 

hmtoggle_plus1Python

 

 

See also:

QMReadBlk(), QMReadSeq(), QMSeek(), QMWeofSeq(), QMWriteBlk(), QMWriteSeq()