How do I resolve a relative path to an absolute path in C?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 06:57:11

问题


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?


回答1:


I think you are looking for _fullpath().




回答2:


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!