DLM File

File Read

dlm_FileRead()

Reads an event from the file.

Syntax
#include "dlmfile.h"

DlmResult dlm_FileRead
    (
        DlmFileId   id,
        DlmEvent *  eventOut
    );
id id of file to read from
eventOut output for event read
Description

dlm_FileRead() reads an event from the file. Events read must eventually be released back to the file session by calling dlm_FileReleaseEvent().

Return Values

If successful, dlm_FileRead() returns a non-negative value. Otherwise, it returns a negative value indicating the reason it failed. Possible unsuccessful return values are:

See Also

dlm_FileReadEvents()
dlm_FileReleaseEvent()
dlm_FileWrite()

Example
if ((result = dlm_FileRead(id, &event)) < 0)
{
    printf("Error: Failure reading %s.\n", dlm_ErrorMessage(result));
}
else
{
    /* do something */

    if ((result = dlm_FileReleaseEvent(id, event)) < 0)
    {
        printf("Error: Failure releasing event (%p): (%d) %s.\n",
                       event, result, dlm_ErrorMessage(result));
    }
    else
    {
        printf("Event released.\n");
    }
}