1make_relative_filename(3)       Allegro manual       make_relative_filename(3)
2
3
4

NAME

6       make_relative_filename  -  Tries to make a relative filename from abso‐
7       lute path and filename. Allegro game programming library.
8

SYNOPSIS

10       #include <allegro.h>
11
12
13       char *make_relative_filename(char *dest, const char *path,  const  char
14       *filename, int size);
15

DESCRIPTION

17       Attempts to make a relative filename from an absolute path and an abso‐
18       lute filename, storing at most `size' bytes  into  the  `dest'  buffer.
19       This  function won't work if the paths are not canonical under the cur‐
20       rent platform (see canonicalize_filename()).  Also,  `dest'  cannot  be
21       used as input value for `path' or `filename'. Example:
22
23          char base[] = "/long/absolute/path/program.exe";
24          char user_input[] = "/nice/and/short.txt";
25          ...
26          make_relative_filename(buf, base, user_input, sizeof(buf));
27          /* Under Unix buf would contain:
28             ../../../nice/and/short.txt */
29

RETURN VALUE

31       Returns  a  copy  of  the `dest' parameter if it succeeds or NULL if it
32       fails (eg. under DOS, one path  starts  with  "C:\"  and  another  with
33       "A:\").
34
35

SEE ALSO

37       make_absolute_filename(3),  is_relative_filename(3), canonicalize_file‐
38       name(3)
39
40
41
42Allegro                          version 4.4.3       make_relative_filename(3)
Impressum