c++ - How to get full path by just giving filename? -
please not getting how implement function returns full path of file using c/c++?
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);
windows:
#include <windows.h> tchar full_path[max_path]; getfullpathname(_t("foo.dat"), max_path, full_path, null);
Comments
Post a Comment