al_open_memfile - Man Page

Allegro 5 API

Synopsis

#include <allegro5/allegro_memfile.h>

ALLEGRO_FILE *al_open_memfile(void *mem, int64_t size, const char *mode)

Description

Returns a file handle to the block of memory. All read and write operations act upon the memory directly, so it must not be freed while the file remains open.

The mode can be any combination of “r” (readable) and “w” (writable). Regardless of the mode, the file always opens at position 0. The file size is fixed and cannot be expanded. The file is always read from/written to in binary mode, which means that no newline translation is performed.

It should be closed with al_fclose(3). After the file is closed, you are responsible for freeing the memory (if needed).

Info

Allegro reference manual