The Boost.Filesystem library provides facilities to manipulate files and directories, and the paths that identify them.
Questions tagged [boost-filesystem]
353 questions
-1
votes
1 answer
Get size of a directory on a disk in C++
Following is a code snippet I used to get directory size in c++:
boost::system::error_code ec;
boost::filesystem::space_info si =
boost::filesystem::space(path, ec);
if (ec.value() == 0) {
cout << si.capacity - si.available;
}
But…

Doraemon
- 109
- 1
- 7
-1
votes
1 answer
Escape white space in boost::fs::path
What it says on the tin. Is there a cleverer way to replace white spaces in a boost::fs::path that does not require a regex?
EDIT as an example:
_appBundlePath = boost::fs::path("/path/with spaces/here");
regex space(" ");
string sampleFilename =…

Morpheu5
- 2,610
- 6
- 39
- 72
-1
votes
1 answer
Qt vs Boost filesystem recursive file count
void countFiles() {
QString root_path("C:\\");
QTime timer;
timer.start();
std::uint64_t count = 0;
std::queue qt_dirs;
qt_dirs.push(root_path);
while (!qt_dirs.empty()) {
auto dir_path = qt_dirs.front();
…

Pinker
- 65
- 8
-1
votes
1 answer
cannot include some boost header in windows service application
Development Envinronment:
OS: Windows 8
IDE: Visual Studio 2010
Boost Version: 1.55.0
I have a simple application which writes string to a file. Since I have to run the application as windows service, i'm using windows service api such as…

Pritesh Acharya
- 1,596
- 5
- 15
- 36
-2
votes
1 answer
std::filesystem::canonical and std::filesystem::absolute are not working
I am using C++2a standard Visual Studio 2019 as compiler for the code.
std::filesystem::path parentPathX(argv[0]);
std::cout << "Running: " << argv[0] << std::endl;
std::cout << "Path wise: " << parentPathX.string() <<…

Tarun Maganti
- 3,076
- 2
- 35
- 64
-2
votes
3 answers
The best way to ignore files with other extensions when using the C++ experimental ?
With the future C++, is there a better way to ignore files with other than wanted extensions than the one shown in the code snippet below?
I am learning the C++ experimental (http://en.cppreference.com/w/cpp/experimental/fs) while…

pepr
- 20,112
- 15
- 76
- 139
-3
votes
2 answers
boost::filesystem::create_directory threw a boost::filesystem::filesystem_error: Bad address
The TL;DR of my code is the following:
server::server(boost::filesystem::path mappath) : mappath(mappath) {
if(boost::filesystem::is_directory(mappath) && boost::filesystem::exists(mappath)) {
// Do some stuff here
} else {
…

Dan Joe
- 17
- 1
- 3
-3
votes
1 answer
what is the kind of return value of boost filesystem size()
In what unit the size of the file is returned in boost filesystem???
that is boost::filesystem::size() returns an int value. whether it is the size of the file in bits or bytes????
please help me in finding this!

Bakkya
- 447
- 1
- 5
- 8