c++ - Getting a directory name from a filename -


I have a file name (c: \ folder \ foo.txt) and I want to name the folder (c: \ folder ) In Unmanaged C ++, I will do something like this in C #:

  string folder = new FileInfo ("C: \ folder \ foo.txt"). DirectoryName;  

Is there a function that can be used in unmanaged C ++ to remove paths by filenames?

There is a standard Windows function for this, if you only support Windows 8 and above , It is highly recommended to use it instead. In addition to other improvements, it is no longer limited to MAX_PATH (260) characters.


Comments