Skip to content

Files IO functions

Finalspace edited this page May 29, 2026 · 1 revision

This category contains types and functions for handling files and directories. More...

Data Structures

Type Name
struct fplFileEntry
A structure containing the information for a file or directory (name, type, attributes, etc.). More...
struct fplFileHandle
The file handle structure. More...
union fplFilePermissions
fplFilePermissionMasks operator overloads for C++. More...
struct fplFileTimeStamps
A structure containing timestamps for creation/access/modify date. More...
union fplInternalFileEntryHandle
FileAttributeFlags operator overloads for C++. More...
union fplInternalFileHandle
A union containing the internal file handle for any platform. More...
struct fplInternalFileRootInfo
A structure containing the internal root file information. More...

Typedefs

Type Name
typedef uint64_t fplFileTimeStamp
The elapsed seconds since the UNIX epoch (1970-01-01 00:00:00).

Enumerations

Type Name
enum fplFileAttributeFlags {
fplFileAttributeFlags_None , fplFileAttributeFlags_Normal , fplFileAttributeFlags_Hidden , fplFileAttributeFlags_System ,
fplFileAttributeFlags_Archive
}
An enumeration of file attribute flags (Normal, Readonly, Hidden, etc.). More...
enum fplFileEntryType { fplFileEntryType_Unknown , fplFileEntryType_File , fplFileEntryType_Directory }
An enumeration of file entry types (File, Directory, etc.). More...
enum fplFilePermissionFlags { fplFilePermissionFlags_All , fplFilePermissionFlags_CanExecuteSearch , fplFilePermissionFlags_CanWrite , fplFilePermissionFlags_CanRead }
An enumeration of file permission flags. More...
enum fplFilePermissionMasks { fplFilePermissionMasks_None , fplFilePermissionMasks_User , fplFilePermissionMasks_Group , fplFilePermissionMasks_Owner }
fplFilePermissionFlags operator overloads for C++. More...
enum fplFilePositionMode { fplFilePositionMode_Beginning , fplFilePositionMode_Current , fplFilePositionMode_End }
An enumeration of file position modes (Beginning, Current, End). More...

Functions

Type Name
fpl_platform_api bool fplDirectoriesCreate (const char *path)
Creates all the directories in the given path.
fpl_platform_api bool fplDirectoryExists (const char *path)
Checks if the given directory exists and returns a boolean indicating its existence.
fpl_platform_api bool fplDirectoryListBegin (const char *path, const char *filter, fplFileEntry *entry)
Iterates through files/directories in the given directory.
fpl_platform_api void fplDirectoryListEnd (fplFileEntry *entry)
Releases opened resources from iterating through files/directories.
fpl_platform_api bool fplDirectoryListNext (fplFileEntry *entry)
Gets the next file entry from iterating through files/directories.
fpl_platform_api bool fplDirectoryRemove (const char *path)
Deletes the given empty directory without confirmation and returns true when the deletion was successful.
fpl_platform_api bool fplFileAppendBinary (const char *filePath, fplFileHandle *outHandle)
Creates or appends a binary file by the given string path and returns the handle of it.
fpl_platform_api void fplFileClose (fplFileHandle *fileHandle)
Closes the given file and releases the underlying resources and clears the handle to zero.
fpl_platform_api bool fplFileCopy (const char *sourceFilePath, const char *targetFilePath, const bool overwrite)
Copies the given source file to the target path and returns true when the copy was successful.
fpl_platform_api bool fplFileCreateBinary (const char *filePath, fplFileHandle *outHandle)
Creates a binary file for writing to the given string path and returns the handle of it.
fpl_platform_api bool fplFileDelete (const char *filePath)
Deletes the given file without confirmation and returns true when the deletion was successful.
fpl_platform_api bool fplFileExists (const char *filePath)
Checks if the file exists and returns a boolean indicating the existence.
fpl_platform_api bool fplFileFlush (fplFileHandle *fileHandle)
Flushes the buffers of the given file and causes all buffered data to be written to a file.
fpl_common_api size_t fplFileGetPosition (const fplFileHandle *fileHandle)
Gets the current file position in bytes.
fpl_platform_api uint32_t fplFileGetPosition32 (const fplFileHandle *fileHandle)
Gets the current file position in bytes.
fpl_platform_api uint64_t fplFileGetPosition64 (const fplFileHandle *fileHandle)
Gets the current file position in bytes.
fpl_common_api size_t fplFileGetSizeFromHandle (const fplFileHandle *fileHandle)
Gets the file size in bytes for an opened file.
fpl_platform_api uint32_t fplFileGetSizeFromHandle32 (const fplFileHandle *fileHandle)
Gets the file size in bytes for an opened file.
fpl_platform_api uint64_t fplFileGetSizeFromHandle64 (const fplFileHandle *fileHandle)
Gets the file size in bytes for an opened file.
fpl_platform_api size_t fplFileGetSizeFromPath (const char *filePath)
Gets the file size in bytes for the given file.
fpl_platform_api uint32_t fplFileGetSizeFromPath32 (const char *filePath)
Gets the file size in bytes for the given file.
fpl_platform_api uint64_t fplFileGetSizeFromPath64 (const char *filePath)
Gets the file size in bytes for the given file.
fpl_platform_api bool fplFileGetTimestampsFromHandle (const fplFileHandle *fileHandle, fplFileTimeStamps *outStamps)
Gets the timestamps for an opened file.
fpl_platform_api bool fplFileGetTimestampsFromPath (const char *filePath, fplFileTimeStamps *outStamps)
Gets the timestamps for the given file.
fpl_platform_api bool fplFileMove (const char *sourceFilePath, const char *targetFilePath)
Moves the given source file to the target file and returns true when the move was successful.
fpl_platform_api bool fplFileOpenBinary (const char *filePath, fplFileHandle *outHandle)
Opens a binary file for reading from a string path and returns the handle of it.
fpl_platform_api size_t fplFileReadBlock (const fplFileHandle *fileHandle, const size_t sizeToRead, void *targetBuffer, const size_t maxTargetBufferSize)
Reads a block from the given file and returns the number of bytes read.
fpl_platform_api uint32_t fplFileReadBlock32 (const fplFileHandle *fileHandle, const uint32_t sizeToRead, void *targetBuffer, const uint32_t maxTargetBufferSize)
Reads a block from the given file and returns the number of bytes read.
fpl_platform_api uint64_t fplFileReadBlock64 (const fplFileHandle *fileHandle, const uint64_t sizeToRead, void *targetBuffer, const uint64_t maxTargetBufferSize)
Reads a block from the given file and returns the number of bytes read.
fpl_common_api size_t fplFileSetPosition (const fplFileHandle *fileHandle, const intptr_t position, const fplFilePositionMode mode)
Sets the current file position by the given position, depending on the mode it's absolute or relative.
fpl_platform_api uint32_t fplFileSetPosition32 (const fplFileHandle *fileHandle, const int32_t position, const fplFilePositionMode mode)
Sets the current file position by the given position, depending on the mode it's absolute or relative.
fpl_platform_api uint64_t fplFileSetPosition64 (const fplFileHandle *fileHandle, const int64_t position, const fplFilePositionMode mode)
Sets the current file position by the given position, depending on the mode it's absolute or relative.
fpl_platform_api bool fplFileTryGetSizeFromHandle (const fplFileHandle *fileHandle, uint64_t *outSize)
Tries to get the full 64-bit file size in bytes for an opened file, distinguishing a zero-byte file from an error.
fpl_platform_api bool fplFileTryGetSizeFromPath (const char *filePath, uint64_t *outSize)
Tries to get the full 64-bit file size in bytes for the given file, distinguishing a zero-byte file from an error.
fpl_common_api size_t fplFileWriteBlock (const fplFileHandle *fileHandle, const void *sourceBuffer, const size_t sourceSize)
Writes a block to the given file and returns the number of written bytes.
fpl_platform_api uint32_t fplFileWriteBlock32 (const fplFileHandle *fileHandle, const void *sourceBuffer, const uint32_t sourceSize)
Writes a block to the given file and returns the number of written bytes.
fpl_platform_api uint64_t fplFileWriteBlock64 (const fplFileHandle *fileHandle, const void *sourceBuffer, const uint64_t sourceSize)
Writes a block to the given file and returns the number of written bytes.

Detailed Description

This category contains types and functions for handling files and directories.

Typedef Documentation

fplFileTimeStamp

typedef uint64_t fplFileTimeStamp

The elapsed seconds since the UNIX epoch (1970-01-01 00:00:00).

Definition at line 8234 of file final_platform_layer.h.

Enumeration Type Documentation

fplFileAttributeFlags

enum fplFileAttributeFlags

An enumeration of file attribute flags (Normal, Readonly, Hidden, etc.).

Name Description
fplFileAttributeFlags_None No attributes.
fplFileAttributeFlags_Normal Normal.
fplFileAttributeFlags_Hidden Hidden.
fplFileAttributeFlags_System System.
fplFileAttributeFlags_Archive Archive.

Definition at line 8193 of file final_platform_layer.h.

fplFileEntryType

enum fplFileEntryType

An enumeration of file entry types (File, Directory, etc.).

Name Description
fplFileEntryType_Unknown Unknown entry type.
fplFileEntryType_File Entry is a file.
fplFileEntryType_Directory Entry is a directory.

Definition at line 8127 of file final_platform_layer.h.

fplFilePermissionFlags

enum fplFilePermissionFlags

An enumeration of file permission flags.

Name Description
fplFilePermissionFlags_All All (Read, Write, Execute, Search).
fplFilePermissionFlags_CanExecuteSearch CanExecute.
fplFilePermissionFlags_CanWrite CanWrite.
fplFilePermissionFlags_CanRead CanRead.

Definition at line 8140 of file final_platform_layer.h.

fplFilePermissionMasks

enum fplFilePermissionMasks

fplFilePermissionFlags operator overloads for C++.

An enumeration of file permission types.

Name Description
fplFilePermissionMasks_None No mask.
fplFilePermissionMasks_User User.
fplFilePermissionMasks_Group Group.
fplFilePermissionMasks_Owner Owner.

Definition at line 8157 of file final_platform_layer.h.

fplFilePositionMode

enum fplFilePositionMode

An enumeration of file position modes (Beginning, Current, End).

Name Description
fplFilePositionMode_Beginning Starts from the beginning.
fplFilePositionMode_Current Starts from the current position.
fplFilePositionMode_End Starts from the end.

Definition at line 8114 of file final_platform_layer.h.

Function Documentation

fplDirectoriesCreate()

fpl_platform_api bool fplDirectoriesCreate ( const char * path)

Creates all the directories in the given path.

Parameters

Direction Parameter Description
[in] path The path to the directory.

Returns: Returns true when at least one directory was created, false otherwise.

fplDirectoryExists()

fpl_platform_api bool fplDirectoryExists ( const char * path)

Checks if the given directory exists and returns a boolean indicating its existence.

Parameters

Direction Parameter Description
[in] path The path to the directory.

Returns: Returns true when the directory exists, false otherwise.

fplDirectoryListBegin()

fpl_platform_api bool fplDirectoryListBegin ( const char * path, const char * filter, fplFileEntry * entry )

Iterates through files/directories in the given directory.

Parameters

Direction Parameter Description
[in] path The full path.
[in] filter The filter wildcard. If empty or null, it is rewritten internally to "*" (match all) and stored as such in the entry's internal root info.
[out] entry Reference to the file entry structure fplFileEntry.

Returns: Returns true when there was a first entry found, false otherwise.

Note: This function is not recursive, so it will traverse the first level only!

When no initial entry is found, the resources are automatically cleaned up.

path

and

filter are copied into fixed-size buffers inside

entry ; the caller may free or reuse the source strings immediately after this call returns.

See also: Directory Traversing

fplDirectoryListEnd()

fpl_platform_api void fplDirectoryListEnd ( fplFileEntry * entry)

Releases opened resources from iterating through files/directories.

Parameters

Direction Parameter Description
[in,out] entry Reference to the file entry structure fplFileEntry.

Note: It's safe to call this when the file entry is already closed.

See also: Directory Traversing

fplDirectoryListNext()

fpl_platform_api bool fplDirectoryListNext ( fplFileEntry * entry)

Gets the next file entry from iterating through files/directories.

Parameters

Direction Parameter Description
[in,out] entry Reference to the file entry structure fplFileEntry.

Returns: Returns true when there was a next file, otherwise false if not.

Note: This function is not recursive, so it will traverse the first level only!

When no entries are found, the resources are automatically cleaned up.

See also: Directory Traversing

fplDirectoryRemove()

fpl_platform_api bool fplDirectoryRemove ( const char * path)

Deletes the given empty directory without confirmation and returns true when the deletion was successful.

Parameters

Direction Parameter Description
[in] path The path to the directory.

Returns: Returns true when the empty directory was deleted, false otherwise.

fplFileAppendBinary()

fpl_platform_api bool fplFileAppendBinary ( const char * filePath, fplFileHandle * outHandle )

Creates or appends a binary file by the given string path and returns the handle of it.

Parameters

Direction Parameter Description
[in] filePath The file path.
[out] outHandle Reference to the file handle structure fplFileHandle.

Returns: Returns true when the binary file was created / open for appending, false otherwise.

See also: Creating a Binary File

fplFileClose()

fpl_platform_api void fplFileClose ( fplFileHandle * fileHandle)

Closes the given file and releases the underlying resources and clears the handle to zero.

Parameters

Direction Parameter Description
[in,out] fileHandle Reference to the file handle structure fplFileHandle.

See also: Opening a Binary File

fplFileCopy()

fpl_platform_api bool fplFileCopy ( const char * sourceFilePath, const char * targetFilePath, const bool overwrite )

Copies the given source file to the target path and returns true when the copy was successful.

Parameters

Direction Parameter Description
[in] sourceFilePath The source file path.
[in] targetFilePath The target file path.
[in] overwrite The overwrite boolean indicating if the file can be overwritten or not.

Returns: Returns true when the file was copied, false otherwise.

fplFileCreateBinary()

fpl_platform_api bool fplFileCreateBinary ( const char * filePath, fplFileHandle * outHandle )

Creates a binary file for writing to the given string path and returns the handle of it.

Parameters

Direction Parameter Description
[in] filePath The file path.
[out] outHandle Reference to the file handle structure fplFileHandle.

Returns: Returns true when the binary file was created, false otherwise.

See also: Creating a Binary File

fplFileDelete()

fpl_platform_api bool fplFileDelete ( const char * filePath)

Deletes the given file without confirmation and returns true when the deletion was successful.

Parameters

Direction Parameter Description
[in] filePath The path to the file.

Returns: Returns true when the file was deleted, false otherwise.

fplFileExists()

fpl_platform_api bool fplFileExists ( const char * filePath)

Checks if the file exists and returns a boolean indicating the existence.

Parameters

Direction Parameter Description
[in] filePath The path to the file.

Returns: Returns true when the file exists, false otherwise.

fplFileFlush()

fpl_platform_api bool fplFileFlush ( fplFileHandle * fileHandle)

Flushes the buffers of the given file and causes all buffered data to be written to a file.

Parameters

Direction Parameter Description
[in,out] fileHandle Reference to the file handle structure fplFileHandle.

Returns: Returns true when the file buffer was flushed, false otherwise.

fplFileGetPosition()

fpl_common_api size_t fplFileGetPosition ( const fplFileHandle * fileHandle)

Gets the current file position in bytes.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.

Returns: Returns the current file position in bytes.

Note: Depending on the platform/architecture, this supports a max size of 2^31 or 2^63 bytes.

See also: Getting the current file position

fplFileGetPosition32()

fpl_platform_api uint32_t fplFileGetPosition32 ( const fplFileHandle * fileHandle)

Gets the current file position in bytes.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.

Returns: Returns the current file position in bytes.

Note: Supports max size of 2^31.

See also: Getting the current file position

fplFileGetPosition64()

fpl_platform_api uint64_t fplFileGetPosition64 ( const fplFileHandle * fileHandle)

Gets the current file position in bytes.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.

Returns: Returns the current file position in bytes.

Note: Supports max size of 2^63.

See also: Getting the current file position

fplFileGetSizeFromHandle()

fpl_common_api size_t fplFileGetSizeFromHandle ( const fplFileHandle * fileHandle)

Gets the file size in bytes for an opened file.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.

Returns: Returns the file size in bytes or zero.

Note: Depending on the platform/architecture, this supports a max size of 2^31 or 2^63 bytes.

fplFileGetSizeFromHandle32()

fpl_platform_api uint32_t fplFileGetSizeFromHandle32 ( const fplFileHandle * fileHandle)

Gets the file size in bytes for an opened file.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.

Returns: Returns the file size in bytes or zero.

Note: Supports max size of 2^31.

fplFileGetSizeFromHandle64()

fpl_platform_api uint64_t fplFileGetSizeFromHandle64 ( const fplFileHandle * fileHandle)

Gets the file size in bytes for an opened file.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.

Returns: Returns the file size in bytes or zero.

Note: Supports max size of 2^63.

fplFileGetSizeFromPath()

fpl_platform_api size_t fplFileGetSizeFromPath ( const char * filePath)

Gets the file size in bytes for the given file.

Parameters

Direction Parameter Description
[in] filePath The path to the file.

Returns: Returns the file size in bytes or zero.

Note: Depending on the platform/architecture, this supports a max size of 2^31 or 2^63 bytes.

fplFileGetSizeFromPath32()

fpl_platform_api uint32_t fplFileGetSizeFromPath32 ( const char * filePath)

Gets the file size in bytes for the given file.

Parameters

Direction Parameter Description
[in] filePath The path to the file.

Returns: Returns the file size in bytes or zero.

Note: Supports max size of 2^31.

fplFileGetSizeFromPath64()

fpl_platform_api uint64_t fplFileGetSizeFromPath64 ( const char * filePath)

Gets the file size in bytes for the given file.

Parameters

Direction Parameter Description
[in] filePath The path to the file.

Returns: Returns the file size in bytes or zero.

Note: Supports max size of 2^63.

fplFileGetTimestampsFromHandle()

fpl_platform_api bool fplFileGetTimestampsFromHandle ( const fplFileHandle * fileHandle, fplFileTimeStamps * outStamps )

Gets the timestamps for an opened file.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.
[out] outStamps Reference to the file timestamps structure fplFileTimeStamps.

Returns: Returns true when the function succeeded, false otherwise.

fplFileGetTimestampsFromPath()

fpl_platform_api bool fplFileGetTimestampsFromPath ( const char * filePath, fplFileTimeStamps * outStamps )

Gets the timestamps for the given file.

Parameters

Direction Parameter Description
[in] filePath The path to the file.
[out] outStamps Reference to the file timestamps structure fplFileTimeStamps.

Returns: Returns true when the function succeeded, false otherwise.

fplFileMove()

fpl_platform_api bool fplFileMove ( const char * sourceFilePath, const char * targetFilePath )

Moves the given source file to the target file and returns true when the move was successful.

Parameters

Direction Parameter Description
[in] sourceFilePath The source file path.
[in] targetFilePath The target file path.

Returns: Returns true when the file was moved, false otherwise.

fplFileOpenBinary()

fpl_platform_api bool fplFileOpenBinary ( const char * filePath, fplFileHandle * outHandle )

Opens a binary file for reading from a string path and returns the handle of it.

Parameters

Direction Parameter Description
[in] filePath The file path.
[out] outHandle Reference to the file handle structure fplFileHandle.

Returns: Returns true when the binary file was opened, false otherwise.

See also: Opening a Binary File

fplFileReadBlock()

fpl_platform_api size_t fplFileReadBlock ( const fplFileHandle * fileHandle, const size_t sizeToRead, void * targetBuffer, const size_t maxTargetBufferSize )

Reads a block from the given file and returns the number of bytes read.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.
[in] sizeToRead The number of bytes to read.
[out] targetBuffer The target memory to write into.
[in] maxTargetBufferSize Total number of bytes available in the target buffer.

Returns: Returns the number of bytes read, or 0 on EOF or hard error.

Note: A return of 0 is ambiguous: it may mean end-of-file or a read failure (NULL handle, invalid handle, OS-level read error). Disambiguate via the matching

fplFileGetPosition /

fplFileGetSizeFromHandle variant, or check

fplGetLastError .

Depending on the platform/architecture, this supports a max size of 2^31 or 2^63 bytes.

See also: Reading from the file

fplFileReadBlock32()

fpl_platform_api uint32_t fplFileReadBlock32 ( const fplFileHandle * fileHandle, const uint32_t sizeToRead, void * targetBuffer, const uint32_t maxTargetBufferSize )

Reads a block from the given file and returns the number of bytes read.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.
[in] sizeToRead The number of bytes to read.
[out] targetBuffer The target memory to write into.
[in] maxTargetBufferSize Total number of bytes available in the target buffer.

Returns: Returns the number of bytes read, or 0 on EOF or hard error.

Note: A return of 0 is ambiguous: it may mean end-of-file or a read failure (NULL handle, invalid handle, OS-level read error). Disambiguate via

fplFileGetPosition32 /

fplFileGetSizeFromHandle32 , or check

fplGetLastError .

Supports max size of 2^31.

See also: Reading from the file

fplFileReadBlock64()

fpl_platform_api uint64_t fplFileReadBlock64 ( const fplFileHandle * fileHandle, const uint64_t sizeToRead, void * targetBuffer, const uint64_t maxTargetBufferSize )

Reads a block from the given file and returns the number of bytes read.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.
[in] sizeToRead The number of bytes to read.
[out] targetBuffer The target memory to write into.
[in] maxTargetBufferSize Total number of bytes available in the target buffer.

Returns: Returns the number of bytes read, or 0 on EOF or hard error.

Note: A return of 0 is ambiguous: it may mean end-of-file or a read failure (NULL handle, invalid handle, OS-level read error). Disambiguate via

fplFileGetPosition64 /

fplFileGetSizeFromHandle64 , or check

fplGetLastError .

Supports max size of 2^63.

See also: Reading from the file

fplFileSetPosition()

fpl_common_api size_t fplFileSetPosition ( const fplFileHandle * fileHandle, const intptr_t position, const fplFilePositionMode mode )

Sets the current file position by the given position, depending on the mode it's absolute or relative.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.
[in] position Position in bytes.
[in] mode Position mode.

Note: Depending on the platform/architecture, this supports a max size of 2^31 or 2^63 bytes.

See also: Setting the current file position (Seeking)

fplFileSetPosition32()

fpl_platform_api uint32_t fplFileSetPosition32 ( const fplFileHandle * fileHandle, const int32_t position, const fplFilePositionMode mode )

Sets the current file position by the given position, depending on the mode it's absolute or relative.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.
[in] position Position in bytes.
[in] mode Position mode.

Note: Supports max size of 2^31.

See also: Setting the current file position (Seeking)

fplFileSetPosition64()

fpl_platform_api uint64_t fplFileSetPosition64 ( const fplFileHandle * fileHandle, const int64_t position, const fplFilePositionMode mode )

Sets the current file position by the given position, depending on the mode it's absolute or relative.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.
[in] position Position in bytes.
[in] mode Position mode.

Note: Supports max size of 2^63.

See also: Setting the current file position (Seeking)

fplFileTryGetSizeFromHandle()

fpl_platform_api bool fplFileTryGetSizeFromHandle ( const fplFileHandle * fileHandle, uint64_t * outSize )

Tries to get the full 64-bit file size in bytes for an opened file, distinguishing a zero-byte file from an error.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.
[out] outSize Reference that receives the file size in bytes on success. Untouched on failure.

Returns: Returns true when the size was retrieved, false on any error (NULL input, invalid handle, query failed).

fplFileTryGetSizeFromPath()

fpl_platform_api bool fplFileTryGetSizeFromPath ( const char * filePath, uint64_t * outSize )

Tries to get the full 64-bit file size in bytes for the given file, distinguishing a zero-byte file from an error.

Parameters

Direction Parameter Description
[in] filePath The path to the file.
[out] outSize Reference that receives the file size in bytes on success. Untouched on failure.

Returns: Returns true when the size was retrieved, false on any error (NULL input, file not accessible, query failed).

fplFileWriteBlock()

fpl_common_api size_t fplFileWriteBlock ( const fplFileHandle * fileHandle, const void * sourceBuffer, const size_t sourceSize )

Writes a block to the given file and returns the number of written bytes.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.
[in] sourceBuffer Source memory to read from.
[in] sourceSize Number of bytes to write.

Returns: Returns the number of bytes written or zero.

Note: Depending on the platform/architecture, this supports a max size of 2^31 or 2^63 bytes.

See also: Writing to the file

fplFileWriteBlock32()

fpl_platform_api uint32_t fplFileWriteBlock32 ( const fplFileHandle * fileHandle, const void * sourceBuffer, const uint32_t sourceSize )

Writes a block to the given file and returns the number of written bytes.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.
[in] sourceBuffer Source memory to read from.
[in] sourceSize Number of bytes to write.

Returns: Returns the number of bytes written or zero.

Note: Supports max size of 2^31.

See also: Writing to the file

fplFileWriteBlock64()

fpl_platform_api uint64_t fplFileWriteBlock64 ( const fplFileHandle * fileHandle, const void * sourceBuffer, const uint64_t sourceSize )

Writes a block to the given file and returns the number of written bytes.

Parameters

Direction Parameter Description
[in] fileHandle Reference to the file handle structure fplFileHandle.
[in] sourceBuffer Source memory to read from.
[in] sourceSize Number of bytes to write.

Returns: Returns the number of bytes written or zero.

Note: Supports max size of 2^63.

See also: Writing to the file

Final Platform Layer

Pages

Topics

Data Structures

Clone this wiki locally