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 8091663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:06:55+00:00 2026-06-05T20:06:55+00:00

I am trying to cvopy boost::array<char> to std::string . boost::array<char, 1024> _buffer; std::string data;

  • 0

I am trying to cvopy boost::array<char> to std::string.

boost::array<char, 1024> _buffer;
std::string data;
std::copy(_buffer.begin(), _buffer.begin()+bytes_transferred, data.begin());

which is not working. So I changed it a little bit.

char _buffer[1024];
std::string data;
std::copy(_buffer, _buffer+bytes_transferred, data.begin());

second one is not working either.

  • 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-05T20:06:56+00:00Added an answer on June 5, 2026 at 8:06 pm

    You can use back_insert_iterator. Assigning to it will call push_back function of the underlying container so you don’t need to worry with allocating space manually.

    std::copy(_buffer.begin(), _buffer.begin()+bytes_transferred, std::back_inserter(data));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to copy a QList in a std::vector this is my code: std::copy(_param_31.listJobs->list_USCOREjobs.begin(),
I'm trying to use Boost::bind and std::copy to print out the values in a
Im trying to copy an array to a vector, however, when the data is
I am trying to copy a header and a set of data to a
I am trying to copy data from my MYSQL table to SQL Server using
I am trying to pass data around the numpy and boost::ublas layers. I have
I'm trying to use boost::filesystem to copy files and folders (just like a standard
Im trying to copy over data from one table to another in the same
I am trying to create a copy of a boost::function by using a pointer
I am trying to use a ostringstream to build a string which uses the

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.