Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 448
Jojje Avatar asked Dec 02 '11 09:12

Jojje


2 Answers

I think you are looking for _fullpath().

like image 53
Prof. Falken Avatar answered Sep 29 '22 08:09

Prof. Falken


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.

like image 27
nullpotent Avatar answered Sep 29 '22 06:09

nullpotent