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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:20:30+00:00 2026-05-25T11:20:30+00:00

Up until now, whenever I wanted to pass some raw data to a function

  • 0

Up until now, whenever I wanted to pass some raw data to a function (like a function that loads an image from a buffer), I would do something like this:

void Image::load(const char* buffer, std::size_t size);

Today I took a look at the Boost libraries, more specifically at the property_tree/xml_parser.hpp header, and I noticed this function signature:

 template<typename Ptree> 
 void read_xml(std::basic_istream<typename Ptree::key_type::value_type>&, 
               Ptree &, int = 0);

This actually made me curious: is this the correct way to pass around raw data in C++, by using streams? Or am I misinterpreting what the function is supposed to be used for?

If it’s the former, could you please point me to some resource where I can learn how to use streams for this? I haven’t found much myself (mainly API references), and I have’t been able to find the Boost source code for the XML parser either.


Edit: Some extra details

Seems there’s been some confusion as to what I want. Given a data buffer, how can I convert it to a stream such that it is compatible with the read_xml function I posted above? Here’s my specific use case:

I’m using the SevenZip C library to read an XML file from an archive. The library will provide me with a buffer and its size, and I want to put that in stream format such that it is compatible with read_xml. How can I do that?

  • 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-05-25T11:20:31+00:00Added an answer on May 25, 2026 at 11:20 am

    Well, streams are quite used in C++ because of their conveniences:
    – error handling
    – they abstract away the data source, so whether you are reading from a file, an audio source, a camera, they are all treated as input streams
    – and probably more advantages I don’t know of

    Here is an overview of the IOstream library, perhaps that might better help you understand what’s going on with streams:
    http://www.cplusplus.com/reference/iostream/

    Understanding what they are exactly will help you understand how and when to use them.

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

Sidebar

Related Questions

Up until now we used Ant in my company. Whenever we wanted to send
I'm a LaTeX beginner. Up until now whenever I've created a table (using the
Until now I've been used to using DAOs to retrieve information from databases. Other
Up until now I used DateTime.Now for getting timestamps, but I noticed that if
I would like to write a program that keeps asking for user input until
So, on a web-page there are some components that have to be re-positioned whenever
Until now I've always used the ASP.NET MVC framework source for debugging ASP.NET MVC.
Until now I've been only writing console applications but I need to write a
Until now I was logging the Error message and the stack trace of an
Until now, I was debugging my PHP scripts and testcases using vim and 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.