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

  • Home
  • SEARCH
  • 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 6732143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:36:51+00:00 2026-05-26T10:36:51+00:00

I am using the library libvtemm, which has a function write_contents . It takes

  • 0

I am using the library libvtemm, which has a function write_contents. It takes an internal buffer and outputs it to a Glib::RefPtr<Gio::OutputStream> object. I have been trying to find a way to convert the contents of the Gio::OutputStream into a std::string or something similar so that I can play with and move around the data inside to other data structures.

Does anyone know how to either construct a Gio::OutputStream to something like a std::ostream or convert its contents into a std::string?

I see there is a Gio::MemoryOutputStream, would something like this be useful in grabbing the data to a std::ostream?

  • 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-26T10:36:52+00:00Added an answer on May 26, 2026 at 10:36 am

    For those of you who are looking for an answer, here is what I have come up with to read the console buffer into a std::string.

    // Create a mock stream just for this example
    Glib::RefPtr<Gio::MemoryOutputStream> bufStream =
      Gio::MemoryOutputStream::create(NULL, 0, &realloc, &free);
    
    // Create the stringstream to use as an ostream
    std::stringstream ss;
    
    // Get the stream size so we know how much to allocate
    gsize streamSize = bufStream->get_data_size();
    char *charBuf = new char[streamSize+1];
    
    // Copy over the data from the buffer to the charBuf
    memcpy(charBuf, bufStream->get_data(), streamSize);
    
    // Add the null terminator to the "string"
    charBuf[streamSize] = '\0';
    
    // Create a string from it
    ss << charBuf;
    

    Hope this helps someone in the future who comes across a similar problem.

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

Sidebar

Related Questions

I am using a library function called get_count_and_price which returns a 2-tuple (count,price). In
I am using a library that has headers without the .h This defeats visual
I'm using a library which for one certain feature involves variables like so: extern
I am using Poco library and when running my program on other machines which
Using this library, ZXing , we have a project at school in which we'll
I'm using a library, which I've loaded into GHCI. From the names of the
I'm using a library which attempts to do Debug.Assert when I do a certion
I in my android app I am using library which wasn't designed for android
I was using mysql++ library and compiling with GCC 3.3.4. That GCC version had
I am using Enterprise Library 4.0 and I can't find any documentation on creating

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.