troubleshooting Question

Why is this error? C++ stringstream instance?

Avatar of prain
prainFlag for United States of America asked on
2 Comments1 Solution505 ViewsLast Modified:
I am creating this wrapper class:
When I compile this it keep on telling me that there is an error in the mDataStream object definition in the .h file. I do not understand why. I have seen several examples on th enet and I do not see a problem. Can someobe tell me why?


#ifndef BinaryStream_EXISTS
#define BinaryStream_EXISTS

#include <string>
#include <sstream>

class BinaryStream;

namespace Wrsp
    class BinaryStream
          void read(char *, int);
          void write(const char*, int);
          void operator<<(const char* );
          void operator>>(char* );  
           std::stringstream mDataStream(std::stringstream::in | std::stringstream::out | std::stringstream::binary);

#include "BinaryStream.h"

namespace Wrsp
    void BinaryStream::read(char* buffer, int buffersize)
    {, buffersize);

    void BinaryStream::write(const char* buffer, int buffersize)
        mDataStream.write(buffer, buffersize);

    void BinaryStream::operator<<(const char* inChar )
        write(inChar, 1);

    void BinaryStream::operator>>(char* inChar)
        read(inChar, 1);
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros