UNIX / Linux:
#include <limits.h> #include <stdlib.h> char *full_path = realpath("foo.dat", NULL); ... free(full_path);
or
char full_path[PATH_MAX]; realpath("foo.dat", full_path);
Window:
#include <windows.h> TCHAR full_path[MAX_PATH]; GetFullPathName(_T("foo.dat"), MAX_PATH, full_path, NULL);
source share