Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9202483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:16:08+00:00 2026-06-17T23:16:08+00:00

boost::filesystem::file_size() returns boost::uintmax_t . So, How to convert boost::uintmax_t to std::string ?

  • 0

boost::filesystem::file_size() returns boost::uintmax_t. So, How to convert boost::uintmax_t to std::string?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:16:09+00:00Added an answer on June 17, 2026 at 11:16 pm

    Well, you can use some simple approach like:

    boost::lexical_cast<std::string>(size);
    

    Or manually using the stringstream:

    static_cast<std::stringstream>(std::stringstream() << size).str()
    

    The operator for numbers is a member, so it should work on temporary even in C++03; some other overloads are free functions and in C++03 those don’t accept temporary, but you can use std::stringstream().flush(), which returns lvalue reference and than all operator<< overloads work.

    But it’s not just plain number. It’s file size. So it’s quite likely you should be rounding it and handling kB/MB/GB/KiB/MiB/GiB units. In which case have a look at libkibi.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a certain boost::filesystem::path in hand and I'd like to append a string
#include <boost/filesystem/path.hpp> #include <boost/filesystem/operations.hpp> using namespace std; using namespace boost; int main() { boost::filesystem::path
I'm asking boost::filesystem::file_size for a file with path /tmp/test\ file.txt , and it reports
when I try to compile this code: #include <boost/filesystem/path.hpp> #include <boost/filesystem/fstream.hpp> using namespace std;
why is this (pagefile.sys) file not a regular file according to boost::filesystem? I've created
// BOOST Includes #include <boost/assign.hpp> // Boost::Assign #include <boost/assign/list_of.hpp> // Boost::Assign::List_Of #include <boost/assign/std/map.hpp> //
I'm using Boost.Filesystem to create a listing of files in a directory. I use
I'm renaming a file using boost::filesystem, and sometimes the target file will exist. According
I'm using boost filesystem to replace windows C++ functions like CopyFile and MoveFile to
I'm trying to use boost::filesystem to copy files and folders (just like a standard

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.