Skip to content

MTY_ReadFile

chrisd1100 edited this page Aug 25, 2022 · 1 revision

Read the entire contents of a file.

This function reads the file in binary mode.

void *MTY_ReadFile(
    const char * path,
    size_t *     size
);

Parameters

path (const char *)

Path to the file.

size (size_t *)

Set to the size in bytes of the returned buffer.

Return value

void *

The buffer always has its final byte set to 0, allowing you to treat it like a string. This extra byte is not counted in the returned size.

On failure, NULL is returned. Call MTY_GetLog for details.

Platform support

Windows   macOS   Android   Linux   Web  

See also

Module: File

Clone this wiki locally