MemCom Reference Manual > MemCom C API Manual Pages > Database Manager Functions > mcDBopenFile

Name

mcDBopenFile — Open MemCom database

Synopsis

#include <memcom.h>

int mcDBopenFile(const char* name, const char* omode);

Description

mcDBopenFile opens a MemCom database for access in direct, i.e unbuffered input/otuput mode. The database remains in the MemCom environment by the associated handle until it is closed by mcDBcloseFile or until mcExit is called. The database will be opened according to the access code mode (see below). By default MemCom creates a file with write permission for 'owner' and with read permissions for 'group' and for 'others'.

The function returns the database handle in the form of a positive integer or the error status if the return value is less than 0.

Parameters

name

Database name (input). If name is of the format hostname:port:path, a connection to the MemCom server at hostname listening on TCP port port is established, and the remote database path (which is relative to the working directory of the server) is opened.

mode

Database access mode specified in the form of a concatenated string (input). r means read only (default setting). w means write only. rw means read and write. o means 'old', meaning that the function will fail if o has been specified and if the database does not exist. n means 'new', meaning that the function will fail if n has been specified and the database already exists. s means scratch, i.e the database will be deleted when closing. Note that n and s imply w.

See also

mcDBopenFileBuffered, mcDBcloseFile