al_open_memfile
ALLEGRO_FILE *al_open_memfile(void *mem, int64_t size, const char *mode)
Introduced in 5.0.0
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.
It should be closed with al_fclose. After the file is closed, you are responsible for freeing the memory (if needed).
Examples: ex_memfile
Most helpful discussions:
- [A5] How to load an image from memory ? (2)
- Loading bitmap from exe (resource file) (1)
- Allegro5 Save bitmap to byte array (1)
- converting to a bitmap (1)
- [A5] loading multiple images stored in a single .dat (1)
- Use embedded bitmap with Allegro 5 (1)
- Allegro and OpenGL Drawing Problem
- Allegro 5.2.x and Raspberry Pi - failed to create display
- Include ttf in exe
- Get binary stream of bitmap - al_save_bitmap_f() or something like this
Other recent discussions:
- Decrypting files in memory and reading them.
- al_save_config_file_f() returns true when it shouldn't
- al_load_sample's loading many data
- [Allegro 5] Loading resources from memory
- [A5] trouble writing ALLEGRO_BITMAP to zip file
- [A5] al_load_bitmap_f fails
- char buffer to ALLEGRO_BITMAP
- load image from external lib?
- Improving drawing speed
- Freeing memory of memfile