문제

Is there a function that returns the fully qualified path name for any inputted file?

I'm thinking of something like:

LPCSTR path = "foo.bar"
LPCSTR fullPath = FullyQualifiedPath(path);
//fullPath now equals C:\path\to\foo.bar

Thanks

도움이 되었습니까?

해결책

In Win32, call the GetFullPathName function.

다른 팁

Use boost::filesystem http://www.boost.org/doc/libs/1_44_0/libs/filesystem/v2/doc/index.htm

#include <iostream>
#include <boost/filesystem.hpp>

int main()
{
    boost::filesystem::path p = boost::filesystem::complete("foo.bar");
    std::cout << p;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top