I have a C console app where I need to output the absolute path to a file given a (possibly) relative path. What is the best way to do this in C in a Windows environment?
I think you are looking for _fullpath().
nullpotent
GetFullPathName should help you on Windows.
GetFullPathName merges the name of the current drive and directory with a specified file name to determine the full path and file name of a specified file.
来源:https://stackoverflow.com/questions/8354422/how-do-i-resolve-a-relative-path-to-an-absolute-path-in-c