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

后端 未结 2 733
自闭症患者
自闭症患者 2020-12-11 05:15

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?

相关标签:
2条回答
  • 2020-12-11 05:52

    I think you are looking for _fullpath().

    0 讨论(0)
  • 2020-12-11 06:01

    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.

    0 讨论(0)
提交回复
热议问题