Cicode Programming Reference > Cicode Function Categories > Device Functions Introduction > DevClose

DevClose

Closes a device. Any data in the buffer is flushed to the device before it is closed. After a device is closed, its device handle becomes invalid and cannot be used.

Syntax

DevClose(hDev, Mode)

hDev:

The device handle, returned from the DevOpen() function. The device handle identifies the table where data on the associated device is stored.

Mode:

The mode of the close:

0 - Close the device in user mode - the default mode if none is specified. A device opened by Cicode function DevOpen() need to be closed in this mode.

1 - Close the device in remove logging mode - under this mode, the current device will be rolled over to history files immediately. You should only use this mode in a report.

2 - Close the device in keep logging mode - under this mode, the current device will not be rolled over to history files. This allows subsequent messages to be written to the same file. This mode is used internally in a report written in rich text format (rtf).

Note:Do not call DevClose() to the current device in an rtf report. This may make the output file unreadable.

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

DevOpen

Example

DevClose(hDev);

See Also

Device Functions