DFScreat

Creates and opens a file in Direct File Mode, returning a file handle to the called file

Local Servers:blocking
Remote Servers:N/A
NetWare Server:4.x, 5.x, 6.x
Platform:NLM
Service:Direct File System

Syntax

  #include <nwdfs.h>  
   
  LONG DFScreat  (  
     BYTE   *fileName,   
     LONG    access,   
     LONG    flagBits); 
  

Parameters

fileName
(IN) Points to the name of the file to be created. The filename must be NULL-terminated and must include the path, including the volume name but not the server name.
access
(IN) Specifies the access permissions for the file.
flagBits
(IN) Specifies the following when a file is created:
  • 0x0001 DELETE_FILE_ON_CREATE_BIT
  • 0x0002 NO_RIGHTS_CHECK_ON_CREATE_BIT

Return Values

!= -1

The file now exists, is open, and is in direct mode. The return value is the file handle assigned when the file was created.

== -1

An error occurred creating the file.

If -1 is returned, errno is set to

Decimal

Constant

Description

1

ENONENT

No such file.

6

EACCES

Permission denied.

9

EINVAL

Invalid argument.

If the function does not complete successfully, NetWareErrno is set to

Decimal

Hex

Constant

152

(0x98)

ERR_INVALID_VOLUME

156

(0x9C)

ERR_INVALID_PATH

Remarks

Calling DFScreat causes DFS to create a file, or to truncate the file if it already exists and if the current connection has write privileges. The name of the file to be created is given by the filename parameter. If the file exists, it is truncated to contain no data and the preceding permission setting is unchanged. The file is switched to direct mode, forcing subsequent file accesses to be direct (The file must be extended using DFSExpandFile to provide required file space). The file is left open and must be closed by a subsequent call to DFSclose.

Not all functions are allowed with this form of open once the file has been created. If additional functions such as specifying a stream are required, the caller should close the file and open it again by calling DFSsopen.

The access permissions are defined in FCNTL.H as follows:

Hex

Constant

Description

0x0000

O_RDONLY

open for read only now if this wrap

0x0001

O_WRONLY

open for write only

0x0002

O_RDWR

open for read and write

0x0010

O_APPEND

writes done at end of file

0x0020

O_CREAT

create new file if one does not exist

0x0040

O_TRUNC

truncate existing file

0x0080

O_EXCL

exclusive open

If access is 0, the default value is O_CREAT, O_TRUNC, and O_WRONLY.

See Also

DFSclose, DFSExpandFile, DFSsopen