File system hooks
ALLEGRO_FS_ENTRYOpaque filesystem entry object. Represents a file or a directory (check with al_is_directory or al_is_file). There are no user accessible member variables. EnumerationsALLEGRO_FS_FILTERFile system search filters. Type Filters:
Permission Filters:
Access Filters:
Other Filters:
ALLEGRO_FS_MKTEMP_UNLINKal_fs_mktemp unlink modes
ALLEGRO_FS_MODEFilesystem modes/types
ALLEGRO_FS_SORTFilesystem search sort flags
XXX do we need ALLEGRO_FS_SORT_TYPE? It sounds like we don't even know what it should do. ALLEGRO_SEEK
Search Path Routinesal_add_search_pathAdds a path to the list of directories to search for files when searching/opening files with a relative pathname. al_get_search_pathFills in 'dest' up to 'len' bytes with the 'idx'th search path item. Parameters: idx - index of search path element requested dest - memory buffer to copy path to len - length of memory buffer Returns true on success, and false on failure. errno is set to indicate the error. Possible Errors: * EINVAL - invalid item selected * ERANGE - buffer not large enough See also: al_get_errno al_search_path_countReturns the number of items in the search path list. File Manipulational_create_entryCreates an ALLEGRO_FS_ENTRY object pointing to path. 'path' can be a file or a directory and must not be NULL. al_destroy_entryDestroys a fs entry handle. Closes file if it was open. al_close_entryCloses fs entry. al_closedirCloses a previously opened directory entry object. al_close_entry is also a valid way to close any entry object. Does not free the entry object if it was opened with al_opendir. XXX This is probably a bug. Returns true on succes, false on failure and fills in errno to indicate the error. al_mkdirCreates a new directory on disk given the path 'path'. Returns false on error and fills in errno to indicate the error. See also: al_get_errno al_mktempMake a temporary randomly named file given a filename 'template' and 'ulink' flags. 'template' is a string giving the format of the generated filename and should include one or more capital Xs. The Xs are replaced with random alphanumeric chars. 'ulink' is one of:
al_open_entryOpens handle with mode 'mode'. mode is a stdio type mode, ie: "r", "w", etc Returns true on success, false on failure and fills in errno to indicate the error. See also: al_get_errno al_opendirCreates and opens a filesystem entry object for a directory. Returns NULL on error. al_readdirReads the next dir item name into 'name' buffer, up to 'size' chars. Warning: this may leave the filename truncated. XXX and how do users know if that's the case? Returns non zero on error. al_unlink_entry"Unlink" or delete this file on disk. Returns true on success, and false on failure, error is indicated in errno. al_unlink_strUnlink 'path' entry from disk. Returns true on success, and false on failure. errno is filled in to indicate the error. See Also: al_unlink_entry al_fstatUpdates stat info for entry 'fp'. Returns true on success, false on failure. Fills in errno to indicate the error. See also al_get_errno al_get_entry_ctime al_is_file File Propertiesal_is_presentCheck if the given entry exists on disk. Returns true if it does exist or false if it doesn't exist, or an error occured. Error is indicated in errno. al_is_present_strCheck if entry 'path' exists on disk. See Also: al_is_present al_is_fileReturn true iff this entry is a regular file. al_is_file_strReturn true if 'path' is a file. See Also: al_is_file al_is_directoryReturn true iff this entry is a directory. al_is_directory_strReturn true if 'path' is a directory. See Also: al_is_directory al_get_entry_modeReturns the entry's mode flags. See also: al_get_errno See the ALLEGRO_FS_MODE enum for valid flags. al_get_entry_mode_strReturns stat 'mode' for fs entry 'path'. See Also: ALLEGRO_FS_MODE al_get_entry_atimeReturns the time in seonds since the epoch since the entry was last accessed. Warning: some filesystem either don't support this flag, or people turn it off to increase performance. It may not be valid in all circumstances. al_get_entry_atime_strReturns last access time for fs entry 'path'. See Also: al_get_entry_atime al_get_entry_ctimeReturns the time in seconds since the epoch this entry was created on the filsystem. al_get_entry_ctime_strReturns creation time for fs entry 'path'. See Also: al_get_entry_ctime al_get_entry_mtimeReturns the time in seconds since the epoch since the entry was last modified. al_get_entry_mtime_strReturns last modification time for fs entry 'path'. See Also: al_get_entry_mtime al_get_entry_nameFills in buf up to size bytes including trailing NULL char with the entry's name Returns true on success, and false on error. errno is set to indicate the error. If buf isn't large enough, errno will be set to ERANGE al_get_entry_sizeReturns the size, in bytes, of the given entry. al_get_entry_size_strReturns file size for fs entry 'path'. See Also: al_get_entry_size File I/Oal_fopenCreates and opens an ALLEGRO_FS_ENTRY object given path and mode. 'path' - the path to open 'mode' - mode to open the entry in ("r", "w", etc.) al_fcloseCloses the given file entry object. Will destroy the handle if it was opened with al_fopen. If you do not wish the entry object destroyed, use al_close_entry instead. al_feofReturns true if we have an end of file condition. al_ferrorReturns true if there was some sort of previous error. al_fgetsReads a string of bytes terminated with a newline (\r,\n,\r\n). Parameters:
Returns: p al_fputsWrites a string to file. Parameters:
Returns: 0 on success or -1 on error Note: Function converts string to UTF8 before writing. al_fflushFlush any pending writes to 'fp' to disk. Returns true on success, false otherwise, and errno is set to indicate the error. See also: al_get_errno al_fgetcRead and return next byte in entry 'f'. Returns EOF on end of file, and 0 on other errors (XXX this is probably a bug) al_fputcWrite a single byte to entry. Parameters: c - byte value to write f - entry to write to Returns: EOF on error al_fungetcUngets a single byte from a file. Does not write to file, it only places the char back into the entry's buffer. See also al_get_errno al_fread32leReads a 32-bit word in little-endian format (LSB first). Returns: The read 32-bit word or EOF on error. al_fwrite32leWrites a 32-bit word in little-endian format (LSB first). Returns: The written 32-bit word or EOF on error. al_fread16leReads a 16-bit word in little-endian format (LSB first). Returns: The read 16-bit word or EOF on error al_fwrite16leWrites a 16-bit word in little-endian format (LSB first). Returns: The written 16-bit word or EOF on error. al_fread32beRead a 32-bit word in big-endian format (MSB first). Returns: The read 32-bit word or EOF on error al_fwrite32beWrites a 32-bit word in big-endian format (MSB first). Returns: The written 32-bit word or EOF on error. al_fread16beReads a 16-bit word in big-endian format (MSB first). Returns: The read 16-bit word or EOF on error. al_fwrite16beWrites a 16-bit word in big-endian format (MSB first). Returns: The written 16-bit word or EOF on error al_freadRead 'size' bytes into 'ptr' from entry 'fp' Return number of bytes actually read. al_fwriteWrite 'size' bytes from 'ptr' into file 'fp' Return number of bytes actually written or 0 on error. Does not distinguish between EOF and other errors. Use al_feof and al_ferror to tell them apart. al_fseekSeek to 'offset' in file based on 'whence'. 'whence' can be:
Returns true on success, false on failure and errno is set to indicate the error. On some platforms this function may not support large files. See also: al_get_errno al_ftellReturns the current position in file, or -1 on error. errno is set to indicate the error. On some platforms this function may not support large files. See also: al_get_errno Otheral_getcwdFill in 'buf' up to 'len' characters with the current working directory. Returns true on success, false on failure. errno is filled in to indicate the error. Possible Errors: * ERANGE - buffer is not large enough See also: al_get_errno al_chdirChanges the current working directory to 'path'. Returns -1 on error. al_path_to_sysConverts path 'orig' to system dependant format. XXX return code? al_path_to_uniConverts path 'orig' to 'allegro' format. XXX return code? al_path_sepFills in 'sep' up to 'len' characters with the path separator string. XXX return code? al_drive_sepFills in 'sep' up to 'len' characters with the drive separator string. XXX return code? |
Last updated: 2009-02-09 09:20:17Z