# QuickReference If you want to paste this into a text editor that can't handle the fancy Unicode section headers, try using [QuickReferenceNoUnicode](QuickReferenceNoUnicode) instead. ```c // PhysicsFS API Quick Reference // // https://icculus.org/physfs/ // // The latest version of this document can be found at https://wiki.icculus.org/PhysicsFS3/QuickReference // Based on physfs version 3.3.0 // // This can be useful in an IDE with search and syntax highlighting. // // Original idea for this document came from Dan Bechard (thanks!) // ASCII art generated by: https://patorjk.com/software/taag/#p=display&f=ANSI%20Shadow (with modified 'S' for readability) // ██████╗ ██╗ ██╗ ██╗ ██╗ ██████╗ ██╗ ██████╗ ██████╗ ███████╗ ██████╗ // ██╔══██╗ ██║ ██║ ╚██╗ ██╔╝ ██╔════╝ ██║ ██╔════╝ ██╔════╝ ██╔════╝ ██╔════╝ // ██████╔╝ ███████║ ╚████╔╝ ███████╗ ██║ ██║ ███████╗ █████╗ ███████╗ // ██╔═══╝ ██╔══██║ ╚██╔╝ ╚════██║ ██║ ██║ ╚════██║ ██╔══╝ ╚════██║ // ██║ ██║ ██║ ██║ ██████╔╝ ██║ ╚██████╗ ██████╔╝ ██║ ██████╔╝ // ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝ #define PHYSFS_DEPRECATED // A macro to tag a symbol as deprecated. #define PHYSFS_CALL // The calling conventions for PhysicsFS entry points. #define PHYSFS_file // 1.0 API compatibility define. #define PHYSFS_VER_MAJOR // The current major version of the PhysicsFS headers. #define PHYSFS_VER_MINOR // The current minor version of the PhysicsFS headers. #define PHYSFS_VER_PATCH // The current patch (or micro) version of the PhysicsFS headers. #define PHYSFS_VERSION(x) // Macro to determine PhysicsFS version program was compiled against. void PHYSFS_getLinkedVersion(PHYSFS_Version *ver); // Get the version of PhysicsFS that is linked against your program. int PHYSFS_init(const char *argv0); // Initialize the PhysicsFS library. int PHYSFS_deinit(void); // Deinitialize the PhysicsFS library. const PHYSFS_ArchiveInfo ** PHYSFS_supportedArchiveTypes(void); // Get a list of supported archive types. void PHYSFS_freeList(void *listVar); // Deallocate resources of lists returned by PhysicsFS. const char * PHYSFS_getLastError(void); // Get human-readable error information. const char * PHYSFS_getDirSeparator(void); // Get platform-dependent dir separator string. void PHYSFS_permitSymbolicLinks(int allow); // Enable or disable following of symbolic links. char ** PHYSFS_getCdRomDirs(void); // Get an array of paths to available CD-ROM drives. const char * PHYSFS_getBaseDir(void); // Get the path where the application resides. const char * PHYSFS_getUserDir(void); // Get the path where user's home directory resides. const char * PHYSFS_getWriteDir(void); // Get path where PhysicsFS will allow file writing. int PHYSFS_setWriteDir(const char *newDir); // Tell PhysicsFS where it may write files. int PHYSFS_addToSearchPath(const char *newDir, int appendToPath); // Add an archive or directory to the search path. int PHYSFS_removeFromSearchPath(const char *oldDir); // Remove a directory or archive from the search path. char ** PHYSFS_getSearchPath(void); // Get the current search path. int PHYSFS_setSaneConfig(const char *organization, const char *appName, const char *archiveExt, int includeCdRoms, int archivesFirst); // Set up sane, default paths. int PHYSFS_mkdir(const char *dirName); // Create a directory. int PHYSFS_delete(const char *filename); // Delete a file or directory. const char * PHYSFS_getRealDir(const char *filename); // Figure out where in the search path a file resides. char ** PHYSFS_enumerateFiles(const char *dir); // Get a file listing of a search path's directory. int PHYSFS_exists(const char *fname); // Determine if a file exists in the search path. int PHYSFS_isDirectory(const char *fname); // Determine if a file in the search path is really a directory. int PHYSFS_isSymbolicLink(const char *fname); // Determine if a file in the search path is really a symbolic link. PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename); // Get the last modification time of a file. PHYSFS_File * PHYSFS_openWrite(const char *filename); // Open a file for writing. PHYSFS_File * PHYSFS_openAppend(const char *filename); // Open a file for appending. PHYSFS_File * PHYSFS_openRead(const char *filename); // Open a file for reading. int PHYSFS_close(PHYSFS_File *handle); // Close a PhysicsFS filehandle. PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle, void *buffer, PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); // Read data from a PhysicsFS filehandle. PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle, const void *buffer, PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); // Write data to a PhysicsFS filehandle. int PHYSFS_eof(PHYSFS_File *handle); // Check for end-of-file state on a PhysicsFS filehandle. PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle); // Determine current position within a PhysicsFS filehandle. int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos); // Seek to a new position within a PhysicsFS filehandle. PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle); // Get total length of a file in bytes. int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 bufsize); // Set up buffering for a PhysicsFS file handle. int PHYSFS_flush(PHYSFS_File *handle); // Flush a buffered PhysicsFS file handle. PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val); // Swap littleendian signed 16 to platform's native byte order. PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val); // Swap littleendian unsigned 16 to platform's native byte order. PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val); // Swap littleendian signed 32 to platform's native byte order. PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val); // Swap littleendian unsigned 32 to platform's native byte order. PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val); // Swap littleendian signed 64 to platform's native byte order. PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val); // Swap littleendian unsigned 64 to platform's native byte order. PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val); // Swap bigendian signed 16 to platform's native byte order. PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val); // Swap bigendian unsigned 16 to platform's native byte order. PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val); // Swap bigendian signed 32 to platform's native byte order. PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val); // Swap bigendian unsigned 32 to platform's native byte order. PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val); // Swap bigendian signed 64 to platform's native byte order. PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val); // Swap bigendian unsigned 64 to platform's native byte order. int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val); // Read and convert a signed 16-bit littleendian value. int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val); // Read and convert an unsigned 16-bit littleendian value. int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val); // Read and convert a signed 16-bit bigendian value. int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val); // Read and convert an unsigned 16-bit bigendian value. int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val); // Read and convert a signed 32-bit littleendian value. int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val); // Read and convert an unsigned 32-bit littleendian value. int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val); // Read and convert a signed 32-bit bigendian value. int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val); // Read and convert an unsigned 32-bit bigendian value. int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val); // Read and convert a signed 64-bit littleendian value. int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val); // Read and convert an unsigned 64-bit littleendian value. int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val); // Read and convert a signed 64-bit bigendian value. int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val); // Read and convert an unsigned 64-bit bigendian value. int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val); // Convert and write a signed 16-bit littleendian value. int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val); // Convert and write an unsigned 16-bit littleendian value. int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val); // Convert and write a signed 16-bit bigendian value. int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val); // Convert and write an unsigned 16-bit bigendian value. int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val); // Convert and write a signed 32-bit littleendian value. int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val); // Convert and write an unsigned 32-bit littleendian value. int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val); // Convert and write a signed 32-bit bigendian value. int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val); // Convert and write an unsigned 32-bit bigendian value. int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val); // Convert and write a signed 64-bit littleendian value. int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val); // Convert and write an unsigned 64-bit littleendian value. int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val); // Convert and write a signed 64-bit bigending value. int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val); // Convert and write an unsigned 64-bit bigendian value. int PHYSFS_isInit(void); // Determine if the PhysicsFS library is initialized. int PHYSFS_symbolicLinksPermitted(void); // Determine if the symbolic links are permitted. int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator); // Hook your own allocation routines into PhysicsFS. int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath); // Add an archive or directory to the search path. const char * PHYSFS_getMountPoint(const char *dir); // Determine a mounted archive's mountpoint. void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d); // Enumerate CD-ROM directories, using an application-defined callback. void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d); // Enumerate the search path, using an application-defined callback. void PHYSFS_enumerateFilesCallback(const char *dir, PHYSFS_EnumFilesCallback c, void *d); // Get a file listing of a search path's directory, using an application-defined callback. void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst, PHYSFS_uint64 len); // Convert a UCS-4 string to a UTF-8 string. void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst, PHYSFS_uint64 len); // Convert a UTF-8 string to a UCS-4 string. void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len); // Convert a UCS-2 string to a UTF-8 string. void PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len); // Convert a UTF-8 string to a UCS-2 string. void PHYSFS_utf8FromLatin1(const char *src, char *dst, PHYSFS_uint64 len); // Convert a UTF-8 string to a Latin1 string. int PHYSFS_caseFold(const PHYSFS_uint32 from, PHYSFS_uint32 *to); // "Fold" a Unicode codepoint to a lowercase equivalent. int PHYSFS_utf8stricmp(const char *str1, const char *str2); // Case-insensitive compare of two UTF-8 strings. int PHYSFS_utf16stricmp(const PHYSFS_uint16 *str1, const PHYSFS_uint16 *str2); // Case-insensitive compare of two UTF-16 strings. int PHYSFS_ucs4stricmp(const PHYSFS_uint32 *str1, const PHYSFS_uint32 *str2); // Case-insensitive compare of two UCS-4 strings. int PHYSFS_enumerate(const char *dir, PHYSFS_EnumerateCallback c, void *d); // Get a file listing of a search path's directory, using an application-defined callback, with errors reported. int PHYSFS_unmount(const char *oldDir); // Remove a directory or archive from the search path. const PHYSFS_Allocator * PHYSFS_getAllocator(void); // Discover the current allocator. int PHYSFS_stat(const char *fname, PHYSFS_Stat *stat); // Get various information about a directory or a file. void PHYSFS_utf8FromUtf16(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len); // Convert a UTF-16 string to a UTF-8 string. void PHYSFS_utf8ToUtf16(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len); // Convert a UTF-8 string to a UTF-16 string. PHYSFS_sint64 PHYSFS_readBytes(PHYSFS_File *handle, void *buffer, PHYSFS_uint64 len); // Read bytes from a PhysicsFS filehandle. PHYSFS_sint64 PHYSFS_writeBytes(PHYSFS_File *handle, const void *buffer, PHYSFS_uint64 len); // Write data to a PhysicsFS filehandle. int PHYSFS_mountIo(PHYSFS_Io *io, const char *newDir, const char *mountPoint, int appendToPath); // Add an archive, built on a PHYSFS_Io, to the search path. int PHYSFS_mountMemory(const void *buf, PHYSFS_uint64 len, PHYSFS_FreeCallback del, const char *newDir, const char *mountPoint, int appendToPath); // Add an archive, contained in a memory buffer, to the search path. int PHYSFS_mountHandle(PHYSFS_File *file, const char *newDir, const char *mountPoint, int appendToPath); // Add an archive, contained in a PHYSFS_File handle, to the search path. PHYSFS_ErrorCode PHYSFS_getLastErrorCode(void); // Get machine-readable error information. const char * PHYSFS_getErrorByCode(PHYSFS_ErrorCode code); // Get human-readable description string for a given error code. void PHYSFS_setErrorCode(PHYSFS_ErrorCode code); // Set the current thread's error code. const char * PHYSFS_getPrefDir(const char *org, const char *app); // Get the user-and-app-specific path where files can be written. int PHYSFS_registerArchiver(const PHYSFS_Archiver *archiver); // Add a new archiver to the system. int PHYSFS_deregisterArchiver(const char *ext); // Remove an archiver from the system. int PHYSFS_setRoot(const char *archive, const char *subdir); // Make a subdirectory of an archive its root directory. ```