DSL
Classes | Macros | Functions
Abstract File/Memory Reading/Writing

Classes

struct  DSL_FILE
 

Macros

#define DSL_PHYSFS_API   DSL_API_VIS
 
#define DSL_PHYSFS_API_CLASS   DSL_API_VIS
 

Functions

DSL_API DSL_FILE *DSL_CC RW_OpenFile (const char *fn, const char *mode)
 
DSL_API DSL_FILE *DSL_CC RW_ConvertFile (FILE *fp, bool autoclose)
 
DSL_API DSL_FILE *DSL_CC RW_OpenMemory (int64 size)
 
DSL_API DSL_FILE *DSL_CC RW_ConvertMemory (uint8 *buf, int64 size)
 
DSL_PHYSFS_API DSL_FILE *DSL_CC RW_OpenPhysFS (const char *fn, const char *mode)
 
DSL_PHYSFS_API DSL_FILE *DSL_CC RW_ConvertPhysFS (PHYSFS_file *fp, bool autoclose)
 

Detailed Description

Function Documentation

◆ RW_ConvertFile()

DSL_API DSL_FILE* DSL_CC RW_ConvertFile ( FILE *  fp,
bool  autoclose 
)

Opens a file handle from a FILE handle.

Parameters
fpThe FILE handle to convert.
autocloseIf true we will call fclose() on your FILE handle for you when you close the DSL_FILE handle.
Returns
A handle on success, NULL on failure.

◆ RW_ConvertMemory()

DSL_API DSL_FILE* DSL_CC RW_ConvertMemory ( uint8 *  buf,
int64  size 
)

Creates a handle for a user-supplied region of memory.

Returns
A handle on success, NULL on failure.

◆ RW_ConvertPhysFS()

DSL_PHYSFS_API DSL_FILE* DSL_CC RW_ConvertPhysFS ( PHYSFS_file *  fp,
bool  autoclose 
)

Opens a file handle from a PHYSFS_file handle.

Parameters
fpThe PHYSFS_file handle to convert.
autocloseIf true we will call PHYSFS_close() on your PHYSFS_file handle for you when you close the DSL_FILE handle.
Returns
A handle on success, NULL on failure.

◆ RW_OpenFile()

DSL_API DSL_FILE* DSL_CC RW_OpenFile ( const char *  fn,
const char *  mode 
)

Opens a file handle.

Parameters
fnThe filename of the file to open.
modeThe mode, passed directly to fopen.
Returns
A handle on success, NULL on failure.

◆ RW_OpenMemory()

DSL_API DSL_FILE* DSL_CC RW_OpenMemory ( int64  size)

Creates a handle for a specified amount of memory.

Parameters
sizeThe amount of ram to use.
Returns
A handle on success, NULL on failure.

◆ RW_OpenPhysFS()

DSL_PHYSFS_API DSL_FILE* DSL_CC RW_OpenPhysFS ( const char *  fn,
const char *  mode 
)

Opens a file handle for a file in your PhysicsFS filesystem.

Parameters
fnThe filename of the file to open.
modeThe mode. PHYSFS_openRead if "r" is in the string, PHYSFS_openWrite if "w" is in the string, PHYSFS_openAppend if "a" is in the string.
Returns
A handle on success, NULL on failure.