INtime SDK Help
ReOpenRtFile
INtime SDK v7.1 > About INtime > INtime Kernel > Files > ReOpenRtFile

Closes and reopens an existing file object with new access and share mode.

RTHANDLE ReOpenRtFile(
RTHANDLE hOriginalFile,
DWORD dwAccessMode,
DWORD dwShareMode,
DWORD dwFlags);

Parameters

hOriginalFile
A handle for the object to be reopened. The handle must have been returned from a call to CreateRtFile.
dwAccessMode
The requested access to the file or device, which can be READ_ONLY, WRITE_ONLY, or READ_WRITE.
dwShareMode
The requested sharing mode of the file or device. You cannot request a sharing mode which conflicts with the requested access mode. Possible values include FILE_SHARE_READ, FILE_SHARE_WRITE, FILE_SHARE_DELETE, and FILE_SHARE_ALL.
Note: FILE_SHARE_DELETE is ignored in INtime Distributed RTOS.
dwFlags
Reserved. Set to Zero.

Return value

Returns a RTHANDLE value for the reopened file on success. Returns BAD_RTHANDLE on failure and the file handle, if originally valid, will be in the closed state. Call GetLastRtError to get extended status information.

Status value Meaning
E_EXIST The handle provided is not a valid handle
E_TYPE The handle provided is not a handle for a file
E_IO_HARD An I/O error occurred during the operation
E_CONN_NOT_OPEN The handle provided does not refer to an open file
E_FACCESS The dwAccessMode parameter value conflicts with the share mode in the original CreateRtFile call, or the dwShareMode parameter value conflicts with the access mode in the original CreateRtFile call.
E_PARAM The dwAccessMode or dwShareMode parameter is invalid
E_SHARE The file’s share state is not compatible with the dwShareMode provided in the call

Requirements

Versions Defined in Include Link to
INtime 6.0 intime/rt/include/rtbase.h rt.h rt.lib

See Also