DMOPENSTREAM(5ICD)

NAME
dmOpenStream - open a DDM stream

SYNOPSIS

#include "dmincl.h"
DM_STREAM *dmOpenStream (key, stream, mode)
DM_CELL *key;
char *stream, *mode;

PARAMETERS
is a pointer to a valid DM_CELL as obtained from function dmCheckOut(). names the stream that must be opened. specifies the mode of the stream as with fopen(3S).

DESCRIPTION
Function dmOpenStream() opens the stream named by stream and returns a DM_STREAM pointer. The (absolute) pathname of the file is obtained from the key argument, depending on the mode parameter.

If the mode will open the stream for read-only (mode == "r") the path points to the domain object as specified by the parameters of dmCheckOut().

If the mode will open the stream for writing, (all other modes) the path points to the range object. However, if the mode == "r+" and the checkout mode is UPDATE, the stream is first copied from the domain object into the range object.

FILES
view/cell/file

DIAGNOSTICS
Function dmOpenStream() will check from the information found in key whether the mode of opening is permitted. For example, when the version parameter for the function dmCheckOut() was ACTUAL it is not permitted to open the "box" stream for writing.

Function dmOpenStream() returns the pointer NULL if the named stream cannot be accessed, or the constraints mentioned above are violated. External variable dmerrno will be set to indicate the error, and a call to function dmError() will be done.
This might happen in the following cases:

DME_BADKEY
    Illegal access key given.

DME_MODE
    Illegal access mode specified.

DME_FOPEN
    Cannot open stream with specified mode.

SEE ALSO
fopen(3S), dmCheckOut(5ICD).

NOTE
Currently no versioning and transaction recovery are supported, and only one object is involved in a cell transaction. Hence, dmOpenStream() does not distinguish between domain and range object.