1al_fopen(3) al_fopen(3)
2
3
4
6 al_fopen - Allegro 5 API
7
9 #include <allegro5/allegro.h>
10
11 ALLEGRO_FILE *al_fopen(const char *path, const char *mode)
12
14 Creates and opens a file (real or virtual) given the path and mode.
15 The current file interface is used to open the file.
16
17 Parameters:
18
19 · path - path to the file to open
20
21 · mode - access mode to open the file in ("r", "w", etc.)
22
23 Depending on the stream type and the mode string, files may be opened
24 in "text" mode. The handling of newlines is particularly important.
25 For example, using the default stdio-based streams on DOS and Windows
26 platforms, where the native end-of-line terminators are CR+LF se‐
27 quences, a call to al_fgetc(3) may return just one character ('\n')
28 where there were two bytes (CR+LF) in the file. When writing out '\n',
29 two bytes would be written instead. (As an aside, '\n' is not defined
30 to be equal to LF either.)
31
32 Newline translations can be useful for text files but is disastrous for
33 binary files. To avoid this behaviour you need to open file streams in
34 binary mode by using a mode argument containing a "b", e.g. "rb",
35 "wb".
36
37 Returns a file handle on success, or NULL on error.
38
40 al_set_new_file_interface(3), al_fclose(3).
41
42
43
44Allegro reference manual al_fopen(3)