Using Boost.Filesystem:
boost::filesystem::path p("C:\\folder\\foo.txt");
boost::filesystem::path dir = p.parent_path();
More Related Contents:
- How can I get the list of files in a directory using C or C++?
- How can I create directory tree in C++/Linux?
- Checking if a directory exists in Unix (system call)
- Create a directory if it doesn’t exist
- How do I get a list of files in a directory in C++? [duplicate]
- Include all files in a directory?
- Write a file in a specific path in C++
- Getting current directory in .NET web application
- How can I find the size of all files located inside a folder?
- Why should I use a pointer rather than the object itself?
- How to add additional libraries to Visual Studio project?
- Variable initialization in C++
- How to use the Qt’s PIMPL idiom?
- problem sorting using member function as comparator
- Mismatch Detected for ‘RuntimeLibrary’
- Is adding to a “char *” pointer UB, when it doesn’t actually point to a char array?
- Allocating more memory than there exists using malloc
- std::unique_lock or std::lock_guard?
- write and read string to binary file C++
- Which C++ signals/slots library should I choose? [closed]
- How do I get the application data path in Windows using C++?
- constexpr function parameters as template arguments
- Nullable values in C++
- Which standard wording tells us that ref-to-const temporary lifetime extension only “works once”?
- Rotate cv::Mat using cv::warpAffine offsets destination image
- Prefix/Postfix increment operators
- Why does C++11 have `make_shared` but not `make_unique` [duplicate]
- What is a .h.gch file?
- When to use extern “C” in C++? [duplicate]
- C++ Best way to get integer division and remainder