Jojje
Jojje

Reputation: 773

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?

Upvotes: 6

Views: 14496

Answers (2)

nullpotent
nullpotent

Reputation: 9260

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.

Upvotes: 4

Prof. Falken
Prof. Falken

Reputation: 24867

I think you are looking for _fullpath().

Upvotes: 8

Related Questions