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

后端 未结 2 737
自闭症患者
自闭症患者 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 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.

提交回复
热议问题