How do you get a files path using C++/CLI?

bobuck man 61 Reputation points
2021-10-01T14:31:05.97+00:00

Yo. VC++ noob here. I was wondering how I could get a files path using C++/CLI. The file is defined in a variable but I don't see a property for path or location.

Developer technologies C++
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 122.6K Reputation points
    2021-10-01T14:36:09.01+00:00

    Check an example:

    using namespace System::IO;
    
    String^ example = R"(C:\My Folders\Folder1\File1.txt)";
    
    String^ path = Path::GetDirectoryName( example ); 
    
    // result: "C:\My Folders\Folder1"
    
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.