NXFileSetLengthWithHandle

Sets the logical length of the file.

Library:LibC
Classification:NKS
Service:File and Directory I/O

Syntax

  #include <nks/fsio.h> 
  
  int NXFileSetLengthWithHandle (
     NXHandle_t      fileHandle, 
     NXOffset_t      length, 
     unsigned long   flags);
  

Parameters

fileHandle

(IN) Specifies a handle to a previously opened file (rather than a path).

length

(IN) Specifies the new file length.

flags

(IN) Not currently used. Set to 0.

Return Values

If successful, returns 0. Otherwise, returns one of the following error codes:

Decimal

Hex

Constant

Description

1

0x01

NX_ENOENT

The specified file does not exist.

4

0x04

NX_EBADF

The file handle does not specify or no longer specifies an open file.

6

0x06

NX_EACCES

Insufficient access rights to the file.

105

0x69

NX_ENOCONTEXT

The calling thread has no NKS context.

Remarks

Before calling the NXFileSetLengthWithHandle function, you must first open the file for writing. The actual physical size of the file can be smaller, larger, or the same as the length parameter.

See Also