1get_filename(3) Allegro manual get_filename(3)
2
3
4
6 get_filename - Returns a pointer to the filename portion of a path.
7 Allegro game programming library.
8
10 #include <allegro.h>
11
12
13 char *get_filename(const char *path);
14
16 Finds out the filename portion of a completely specified file path.
17 Both `\' and `/' are recognized as directory separators under DOS and
18 Windows. However, only `/' is recognized as directory separator under
19 other platforms. Example:
20
21 get_executable_name(name, sizeof(name));
22 allegro_message("Running `%s'\n", get_filename(name));
23
24 Note that Allegro won't perform any IO operations during the verifica‐
25 tion. This means that if you have `/a/path/like/this/', which doesn't
26 have a filename, the function will return a pointer to the trailing
27 null character. However, if you have `/a/path/like/this', Allegro will
28 return a pointer to `this', even if it is a valid directory.
29
31 Returns a pointer to the portion of `path' where the filename starts,
32 or the beginning of `path' if no valid filename is found (eg. you are
33 processing a path with backslashes under Unix).
34
35
37 get_extension(3), put_backslash(3), replace_filename(3), exmidi(3)
38
39
40
41Allegro version 4.2.3 get_filename(3)