1al_fopen_slice(3) al_fopen_slice(3)
2
3
4
6 al_fopen_slice - Allegro 5 API
7
9 #include <allegro5/allegro.h>
10
11 ALLEGRO_FILE *al_fopen_slice(ALLEGRO_FILE *fp, size_t initial_size, const char *mode)
12
14 Opens a slice (subset) of an already open random access file as if it
15 were a stand alone file. While the slice is open, the parent file han‐
16 dle must not be used in any way.
17
18 The slice is opened at the current location of the parent file, up
19 through initial_size bytes. The initial_size may be any non-negative
20 integer that will not exceed the bounds of the parent file.
21
22 Seeking with ALLEGRO_SEEK_SET will be relative to this starting loca‐
23 tion. ALLEGRO_SEEK_END will be relative to the starting location plus
24 the size of the slice.
25
26 The mode can be any combination of:
27
28 · r: read access
29
30 · w: write access
31
32 · e: expandable
33
34 For example, a mode of "rw" indicates the file can be read and written.
35 (Note that this is slightly different from the stdio modes.) Keep in
36 mind that the parent file must support random access and be open in
37 normal write mode (not append) for the slice to work in a well defined
38 way.
39
40 If the slice is marked as expandable, then reads and writes can happen
41 after the initial end point, and the slice will grow accordingly. Oth‐
42 erwise, all activity is restricted to the initial size of the slice.
43
44 A slice must be closed with al_fclose(3). The parent file will then be
45 positioned immediately after the end of the slice.
46
48 5.0.6, 5.1.0
49
51 al_fopen(3)
52
53
54
55Allegro reference manual al_fopen_slice(3)