[LC++]Passing ifstream around

Carlo Wood carlo at alinoe.com
Thu Nov 1 03:45:48 UTC 2001


On Wed, Oct 31, 2001 at 02:31:50PM +0100, Laszlo Boszormenyi wrote:
> Hi,
> 
> I would like to pass ifstream to a dynamicaly created object, but I get
> various error messages. Fe. ios::ios is private in the scope of Reader
> etc. Can someone help me how to fix this?
> 
> Thanks, GCS

> #include <fstream>
> #include <iostream>
> 
> class Reader {
> public:
> 	Reader(ifstream in);

You cannot pass an ifstream: you can not copy it.
You will have to pass a reference or pointer to it.

-- 
Carlo Wood <carlo at alinoe.com>



More information about the tuxCPProgramming mailing list