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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:10:23+00:00 2026-05-26T22:10:23+00:00

We have created and filled some std::vector<uchar> with openCV imencode for example. Now we

  • 0

We have created and filled some std::vector<uchar> with openCV imencode for example. Now we want to stream it for example into some http_lib which can take some sort of ostream (ostringstream) for example, or we just want to save in while we debug our programm with ofstream. So I wonder how to put std::vector<uchar> into 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-26T22:10:23+00:00Added an answer on May 26, 2026 at 10:10 pm

    Use write:

    void send_data(std::ostream & o, const std::vector<uchar> & v)
    {
      o.write(reinterpret_cast<const char*>(v.data()), v.size());
    }
    

    The ostream expects naked chars, but it’s fine to treat uchars as those by casting that pointer. On older compilers you may have to say &v[0] instead of v.data().

    You can return the result of write() as another std::ostream& or as a bool if you like some error checking facilities.

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

Sidebar

Related Questions

I have an options menu created and filled with several menu items. For some
I have some office records. Database is already created and filled with lots of
I have a SqlServer database that I've manually filled with some test data. Now
I have created rectangle shapes using onDraw method, filled with single colors. Now I
I have an SQLite database. I created the tables and filled them with a
I have created a few small flash widgets that stream .mp3 audio from an
I have created a table which is filled in with remote data. I'm getting
In Oracle I've created a data type: TABLE of VARCHAR2(200) I want to have
I've created a table with some C# and asp.net for be filled by data
I have a Panel I want to fill with some UserControl(s) at runtime. These

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.