Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with porting standard stream classes from VS6.0 to VS.NET 2003

2 views
Skip to first unread message

Leo Violette

unread,
May 26, 2004, 8:11:48 PM5/26/04
to
In VS6.0, we had a class defined as follows:
class ibstream : public istream
{
public:
ibstream();
ibstream(streambuf*);

private:
int offset;
byte ch;
}

ibstream::ibstream () : istream()
{ <- Error line points here
offset = 0;
ch = 0;
}


ibstream::ibstream (streambuf* sb) : istream(sb)
{
offset = 0;
ch = 0;
}


Now, in VS.NET, I try to recompile this code and it gives me an error on the
default constructor like the following:
c:\Appdev\...\pdfcrypt.cpp(81) : error C2512:
'std::basic_istream<_Elem,_Traits>' : no appropriate default constructor
available
with
[
_Elem=char,
_Traits=std::char_traits<char>
]

I think it doesn't like the default construction of istream(). Is there an
easy work around for this, or will I have to look into redesigning?

Jaded Hobo

unread,
May 27, 2004, 2:22:04 AM5/27/04
to

"Leo Violette" <lvio...@orrtax.com> schreef in bericht
news:edhQx73...@TK2MSFTNGP11.phx.gbl...

There is no default constructor for std::basic_istream(). You will have to
construct it with a pointer to a basic_streambuf object as you do in the
second constructor for your ibstream class.

Antoon


Werner Salomon

unread,
May 27, 2004, 4:59:47 AM5/27/04
to
"Leo Violette" <lvio...@orrtax.com> wrote in message news:<edhQx73...@TK2MSFTNGP11.phx.gbl>...

> In VS6.0, we had a class defined as follows:
> class ibstream : public istream
> {
> public:
> ibstream();
> ibstream(streambuf*);
>
> private:
> int offset;
> byte ch;
> }
>
> ibstream::ibstream () : istream()
> { <- Error line points here

Hi Leo,
try
ibstream::ibstream ()
: istream( 0 )
{
// ...


Greetings
Werner

0 new messages