2.6.1.5 Queries

typedef ptrdiff_t ZixFileOffset

An offset into a file or a file size in bytes.

This is signed, and may be 64 bits even on 32-bit systems.

enum ZixFileType

A type of file.

Note that not all types may be supported, and the system may support additional types not enumerated here.

enumerator ZIX_FILE_TYPE_NONE

Non-existent file.

enumerator ZIX_FILE_TYPE_REGULAR

Regular file.

enumerator ZIX_FILE_TYPE_DIRECTORY

Directory.

Symbolic link.

enumerator ZIX_FILE_TYPE_BLOCK

Special block file.

enumerator ZIX_FILE_TYPE_CHARACTER

Special character file.

enumerator ZIX_FILE_TYPE_FIFO

FIFO.

enumerator ZIX_FILE_TYPE_SOCKET

Socket.

enumerator ZIX_FILE_TYPE_UNKNOWN

Existing file with unknown type.

ZixFileOffset zix_file_size(const char *path)

Return the size of a file.

Note that the returned value is signed and must be checked for errors. Non-negative values can be thought of as the “end” offset just past the last byte.

Returns:

A non-negative size in bytes, or -1 on error.

ZixFileType zix_file_type(const char *path)

Return the type of a file or directory, resolving symlinks.

Return the type of a file or directory or symlink.

On Windows, a directory symlink (actually a “reparse point”) always appears as a directory.