QMWriteu |
|
|
The QMWriteu function writes a record, retaining the lock. This is analogous to the QMBasic WRITEU statement.
Format
where
The QMWriteu function writes the given data to the file opened as FileNo. If a record with this Id already exists, it is replaced. If the record does not already exist, it is added.
An application should always obtain an update lock on the record before writing it. The lock is retained on return from this function.
When writing a new record to a directory file on a Linux or Unix system, the operating system level file that represents the QM record is created using the umask value specified by the UMASK configuration parameter or, if this parameter is not present, a default of 002. This behaviour can be modified by executing a UMASK command either from the LOGIN paragraph or by using the QMExecute() function.
Examples
The above program fragment reads a record with an update lock, modifies it and then writes it back to the file, retaining the lock so that the record may be written again later. A real program should test the ErrNo status from the read operations to determine if they were successful.
Note how the C example uses QMFree() to release the dynamic memory allocated to store Rec and Rec2.
|