FEsopen

Opens a file for shared access

Local Servers:blocking
Remote Servers:blocking
NetWare Server:3.x, 4.x, 5.x, 6.x
Platform:NLM
Service:File Engine

Syntax

   #include <nwfileng.h>  
    
   int FEsopen  (  
      char  *name,   
      int    access,   
      int    share,   
      int    permission,   
      int    flagBits,   
      BYTE   dataStream);
   

Parameters

name

(IN) Points to the name of the file to be opened.

access

(IN) Specifies the access mode of the file.

share

(IN) Specifies the sharing mode of the file.

permission

(IN) Specifies the file permission (if the file is being created).

flagBits

(IN) Specifies the special flags that allow more file flexibility.

dataStream

(IN) Specifies the flag that indicates the data stream under which the file is to be opened.

Return Values

Returns a file handle upon success. Returns a value of -1, and errno and NetWareErrno are set to the appropriate error codes if errors occur. See Return Values for C for more information.

Remarks

FEsopen also works on the DOS partition and is a special version of the sopen function. Call the sopen function if the primary data stream is requested rather than calling FEsopen.

FEsopen does not behave identically to the sopen function when only the O_CREAT and O_TRUNC bits are passed. You must also pass DELETE_FILES_ON_CREATE_BIT to the flagBits parameter in FEsopen which allows the file to be deleted and created again.

The access mode is established as a combination of bits found in the FCNTL.H file and valid values follow:

O_RDONLY

The file can only be read.

O_WRONLY

The file can only be written.

O_RDWR

The file can be read or written.

O_APPEND

Records are written to the end of the file.

O_CREAT

If the file does not exist, it is created.

O_TRUNC

Any data in the file is truncated.

O_BINARY

Data is transmitted unchanged. Text mode is not supported.

The sharing mode is established as a combination of bits found in the NWSHARE.H file and valid values follow:

SH_COMPAT

Sets the compatibility mode.

SH_DENYRW

Prevents read or write access to the file.

SH_DENYWR

Prevents write access to the file.

SH_DENYRD

Prevents read access to the file.

SH_DENYNO

Permits both read and write access to the file.

NOTE:If a new file is created, the share flag is ignored.

If FEsopen opens a file for compressed file I/O, the file must be opened in "exclusive mode" with SH_DENYRW. Otherwise, FEsopen fails.

The permission mode is established as a combination of bits found in the SYS\STAT.H file and valid values follow:

S_IWRITE

The file is writeable.

S_IREAD

The file is readable.

A value of 0 can be specified to indicate that the file is readable and writeable.

The flag bits are in nwfattr.h and valid values follow:

DELETE_FILE_ON_CREATE_BIT

If the file already exists, it is deleted allowing the file to be created again.

NO_RIGHTS_CHECK_ON_ OPEN_BIT

The rights to the file are not checked when the file is opened.

NO_RIGHTS_CHECK_ON_ CREATE_BIT

The rights to the file are not checked when the file is created.

FILE_WRITE_THROUGH_BIT

When a write is performed, the write function does not return until the data is actually written to disk.

ENABLE_IO_ON_COMPRESSED_ DATA_BIT

Any subsequent I/O on this entry is compressed (NetWare 4.x, 5.x, and 6.x).

LEAVE_FILE_COMPRESSED_ DATA_BIT

After all I/O has been done, leave this file compressed (NetWare 4.x, 5.x, and 6.x).

NOTE:If the flag is set to ENABLE_IO_ON_COMPRESSED_DATA_BIT or LEAVE_FILE_COMPRESSED_DATA_BIT (can be ORed), the share parameter must be set to SH_DENYRW or FEsopen fails.

The dataStream parameter is a constant defined in nwfattr.h indicating which of the data streams (streams of data stored as separate files on the volume) associated with a file stored on a NetWare 3.x or above server is to be opened. The defined data streams are PrimaryDataStream, MACResourceForkDataStream, and FTAMStructuringDataStream.

See Also

close, sopen (Single and Intra-File Services)