DFSSetEndOfFile

Sets file size

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 DFSSetEndOfFile  (  
     LONG   fileHandle,   
     LONG   newFileSize,   
     LONG   returnTruncatedBlocksFlag); 
  

Parameters

fileHandle
(IN) Specifies the file handle returned from a prior DFSsopen or DFScreat call for the indicated file.
newFileSize
(IN) Specifies the new file size in bytes.
returnTruncatedBlocksFlag
(IN) Specifies a nonzero value specified here indicates that any blocks truncated by the new file size should be freed up for future OS use.

Return Values

Decimal

Constant

Description

0

DFSNormalCompletion

The operation is complete as specified.

16

DFSTruncationFailure

The DFSSetEndOfFile function detected that the caller requested excess blocks to be truncated, but the file was open for other connections, causing the request to be rejected.

131

DFSHardIOError

 

136

DFSInvalidFileHandle

A call was made with an invalid file handle. Typically an open was omitted or the user inadvertently closed the file.

Remarks

If the connection making the request is the only entity with the file open and if the returnTruncatedBlocksFlag is nonzero, setting a new file size that is one or more blocks less than the previous file size causes blocks (actually allocated) beyond the new defined file size to be truncated, or returned for future OS usage. If a new file size is specified that is greater than the previous file size, the newly defined file area is zero-filled, provided that actual file space is allocated. A new file size can be specified that is beyond the range of current allocated file space, or that is less than current allocated file space.

See Also

DFSExpandFile, DFSReturnFileMappingInformation, DFSWrite