Solved

What is best approach for managing and accessing files/directories/paths in a windows unmanaged C++ application?

Posted on 2015-01-10
4
210 Views
Last Modified: 2015-01-19
Hi:

It's been a while since I've done unmanaged C++  in windows.

The File class in .Net makes handling/managing files pretty straight forward.

What is the best equivalent thing to do in unmanaged C++ which would make it relatively straightforward
to access/manipulate the filename, path, directory, etc.?

We are using the boost libraries in our project.
I know the boost libraries has boost::filesystem. I'm not quite familiar with that yet.
Is using the boost libraries the best approach?

Thanks,
JohnB
0
Comment
Question by:jxbma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 40542727
The unmanaged part is done by the so called 'Shell Helper APIs', check out http://msdn.microsoft.com/en-us/library/windows/desktop/bb773559%28v=vs.85%29.aspx ("Shell Path Handling Functions"). As a side note, that's what .NET ends up calling when retrieving that information  ;o)
0
 
LVL 29

Assisted Solution

by:pepr
pepr earned 250 total points
ID: 40543763
The Boost C++ Libraries is a kind of unofficial testbed for the C++ standardization process. Its documentation says (http://www.boost.org/doc/libs/1_57_0/libs/filesystem/doc/index.htm):
A proposal, N1975, to include Boost.Filesystem in Technical Report 2 has been accepted by the C++ Standards Committee. That proposal was based on version 2 of Boost.Filesystem; presumably the final TR2 form will be based on version 3.

To keep the sources as up-to-date as possible, you should probably follow the birth of C++14 standard and the later C++17. I did not follow the last development. Have a look at https://isocpp.org/std/status, and http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3803.pdf
0
 
LVL 34

Expert Comment

by:sarabande
ID: 40543880
for many tasks in unmanaged c++ you could be happy with std::ifstream and std::ofstream and std::fstream classes.

Sara
0
 
LVL 29

Expert Comment

by:pepr
ID: 40544136
@jxbma: To make the question clear... Do you mean the manipulation with paths (composing, splitting,...), creating directories, searching for files, testing for existence of a file/directory, getting the information about the file, etc.?

(See http://www.boost.org/doc/libs/1_57_0/libs/filesystem/doc/tutorial.html)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
windbg taking it's time 32 107
gdb doesn't stop on breakpoint 2 140
Problem to open text file 11 144
Gaming Software 1 38
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question