[comp.lang.c++] problem with istream and filebuf

bytor@ctt.bellcore.com (Ross Huitt) (01/23/91)

In article <1991Jan22.125100.26331@rivm.nl> mtvrk@rivm39.rivm.nl (Rob Kok) writes:
>
>I am trying to port a String-library from Interactive 386/ix to Turbo C++ 
>1.0. On Interactive I have Glockenspiel C++.
>Everything seems to work fine, but I have one small problem compiling
>with Turbo C++.
>

// code deleted....

>-----begin code ----
>#define RDBUFSIZE StringIndex( 256 )
>
>StringIndex String::Read( const filebuf& fb, Boolean Joinlines )
                          ^^^^^^^^^^^^^^^^^^
>{
>	istream is( &fb );
>	return Read( is, Joinlines );
>}
>----end code-----
>
>When compiling with the Turbo C++ compiler, the compiler gives an error
>on the line 'istream is( &fb )' :
>
> Type mismatch in parameter 1d in call to 'istream::istream(streambuf far*)'
                                                             ^^^^^^^^^^^^^^
>
>while the Glockenspiel compiler didn't complain.
>
> EMAIL : mtvrk@rivm39.rivm.nl                        FAX : +31 30 250740
>------------------------------------------------------------------------

Looks to me like you tried to pass a 'const' object to a method
expecting a non-'const' argument.  Page 320 of E&S provides an
example and the details are described elsewhere in 13.2.

-ross aka bytor@ctt.bellcore.com

kearns@softrue.UUCP (Steven Kearns) (01/24/91)

Hi.
I suspect the problem is the "cont" of fb.  
-steve

********************************************************
* Steven Kearns            ....uunet!softrue!kearns    *
* Software Truth           softrue!kearns@uunet.uu.net *
********************************************************