NXFileGetLength

Returns the length of a file specified by the path.

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

Syntax

  #include <nks/fsio.h> 
  
  int NXFileGetLength (
     NXPathCtx_t   pathCtx,
     const void   *pathname,
     NXOffset_t   *length);    
  

Parameters

pathCtx

(IN) Specifies a file system path context. Along with the pathname parameter, it specifies the file for which to return its length.

pathname

(IN) Points to a null-terminated Unicode or ASCII string (without wildcards) that specifies the name of the device or console to open.

length

(OUT) Points to a variable to receive the result.

Return Values

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

Decimal

Hex

Constant

Description

1

0x01

NX_ENOENT

The file does not exist.

4

0x04

NX_EBADF

The pathCtx and pathname combination does not refer to a valid description of a file.

6

0x06

NX_EACCES

Insufficient rights to the object.

9

0x09

NX_EINVAL

The pathCtx parameter was specified but pathname indicates a full path

Remarks

If you know the handle on which the file is already open, call NXFileGetLengthWithHandle.

NXFileGetLength is useful when working with Sun's JVM, which calls the stat function more frequently than any other operation (in order to know how much space to allocate to hold the Java source code). NXFileGetLength is meant to be a high-speed function to optimize using the JVM.

See Also