#include <nwmisc.h> or #include <nwcalls.h>NWCCODE N_API NWOpenFile (NWCONN_HANDLE conn, NWDIR_HANDLE dirHandle, pnstr8 fileName, nuint16 searchAttr, nuint8 accessRights, NWFILE_HANDLE fileHandle);
The FA_HIDDEN (0x02) and FA_SYSTEM (0x04) bits in the client's searchAttr flag are used to discover or ignore system and hidden files. File Name is a valid file path and is used with the Directory Handle to indicate which file should be opened.
If this client lacks file open privileges in the target directory, the request fails.
The accessRights flag is a bit field with the following bits defined:
The accessRights flag designates which access rights a client wants in a specified file. The client's initial accessRights are modified to reflect the actual access rights the client is allowed to the specified file. Modifications are determined as follows:
exclusive
bit is cleared in the accessRights flag, the access flag is in its final state, and the server processes the open request.
exclusive
bit is set in the accessRights flag, the client normally expects exclusive access to files. This is roughly equivalent to the
compatibility
bit defined in MS-DOS 3.x. When the exclusive
bit is set, the file's attribute flags are examined and the shareable
bit tested. The
shareable
attribute on a file controls the final access rights granted to a client when the client is opening files in an exclusive-access mode.
shareable
bit is set, the deny read
and deny write
bits are cleared in the accessRights flag. (All clients with appropriate
directory access rights can read from and write to shareable files.)
shareable
bit is cleared and the accessRights flag's write
bit is cleared, the deny read
bit is cleared and the deny
write
bit is set. This allows multiple clients to read from the file with no one writing to it.
shareable
bit is cleared and the accessRights flag's write
bit is set, the deny read
bit is set and the deny write
bit is set. This ensures that the file is kept for the exclusive use of the requesting client.
Clients can open a single file more than once. However, the file must be closed as many times as it is opened before the server releases the file to other clients.
If you want to open a file in compressed mode, you have to use NWOpenDataStream or NWOpenCreateNSEntry.