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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:49:35+00:00 2026-05-17T01:49:35+00:00

I am having problems with a stringstream object. My class has an input stream

  • 0

I am having problems with a stringstream object. My class has an input stream as a member.
I am checking if obj->istream and after thatn if obj->istream->good().

The stream exists but the call to good() crashes. I am in Visual Studio 2005. Any clue?

How do I reset an istream?


if (soap->is) { 

  if (soap->is->good())

      return soap->is->read(s, (std::streamsize)n).gcount();

    return 0;
}

that code is from gsoap framework


std::istringstream in_stream;
in_stream.str("a buffer");
soap->is = &in_stream;

the in_stream goes out of scope, it belongs to a local stack, however the ->is->good()
is called outside that function when in_stream no longer exists.

  • 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-17T01:49:36+00:00Added an answer on May 17, 2026 at 1:49 am

    This probably indicates that your is member does not point to a stringstream. It might just be initialized to some garbage value when enclosing object is instantiated.

    If you are testing for pointer being zero, make sure it’s set to zero in the constructor (and reset to zero if you ever detach the stream).

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

Sidebar

Related Questions

Having problems iterating. Problem has to do with const correctness, I think. I assume
Im having problems with a method in a class file: public static function getPageLeft($pid)
Having problems with domain class mappings. The domains are as follows: User Domain class
Having problems compiling this class. I'm working through a book on java and this
Im having problems when calling a command right after the Focus() call. The command
having problems trying to run by unit test with Ant, my test class uses
Having problems deserializing some xml into an object in C#. The error that I
Im having problems extending a Class. This is what I was trying to do:
Having problems with a small awk script, Im trying to choose the newest of
Having problems with the combining of two statements in a controller. Both statements work

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.