Constants

file.inc

Untitled constant

Note

All paths in AMX Mod X natives are relative to the mod folder
unless otherwise noted.
Most functions in AMX Mod X (at least, ones that deal with direct
file manipulation) will support an alternate path specification.

Maximum path length.

PLATFORM_MAX_PATH
#define PLATFORM_MAX_PATH  256

File inode types for use with open_dir() and next_file().

FileType
enum FileType
{
	FileType_Unknown,       /* Unknown file type (device/socket) */
	FileType_Directory,     /* File is a directory */
	FileType_File,          /* File is a file */
};

File time modes for use with GetFileTime().

FileTimeType
enum FileTimeType
{
	FileTime_LastAccess,    /* Last access (not available on FAT) */
	FileTime_Created,       /* Creation (not available on FAT) */
	FileTime_LastChange,    /* Last modification */
};

File position modes for use with fseek().

SEEK_SET
#define SEEK_SET 0          /* Seek from start */
#define SEEK_CUR 1          /* Seek from current position */
#define SEEK_END 2          /* Seek from end position */

Options for use with file_size() flag parameter.

FSOPT_BYTES_COUNT
#define FSOPT_BYTES_COUNT  0  /* Returns the file size in number of bytes */
#define FSOPT_LINES_COUNT  1  /* Returns how many lines there are in this file */
#define FSOPT_END_WITH_LF  2  /* Returns whether the last line is '\n' */

Data block modes for use with fread*() and fwrite*().

BLOCK_INT
#define BLOCK_INT   4
#define BLOCK_SHORT 2
#define BLOCK_CHAR  1
#define BLOCK_BYTE  1

File permissions flags for use with mkdir() and SetFilePermissions().

FPERM_U_READ
#define FPERM_U_READ       0x0100   /* User can read.    */
#define FPERM_U_WRITE      0x0080   /* User can write.   */
#define FPERM_U_EXEC       0x0040   /* User can exec.    */
#define FPERM_U_RWX        FPERM_U_READ | FPERM_U_WRITE | FPERM_U_EXEC

#define FPERM_G_READ       0x0020   /* Group can read.   */
#define FPERM_G_WRITE      0x0010   /* Group can write.  */
#define FPERM_G_EXEC       0x0008   /* Group can exec.   */
#define FPERM_G_RWX        FPERM_G_READ | FPERM_G_WRITE | FPERM_G_EXEC

#define FPERM_O_READ       0x0004   /* Anyone can read.  */
#define FPERM_O_WRITE      0x0002   /* Anyone can write. */
#define FPERM_O_EXEC       0x0001   /* Anyone can exec.  */
#define FPERM_O_RWX        FPERM_O_READ | FPERM_O_WRITE | FPERM_O_EXEC

#define FPERM_DIR_DEFAULT  FPERM_U_RWX | FPERM_G_RWX | FPERM_O_RWX /* rwx r-x r-x (0755) */