Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ifstream has no constructor

Status
Not open for further replies.

biot023

Programmer
Nov 8, 2001
403
GB
I can't seem to declare an ifstream on the heap.
My code reads:
ifstream* file; //protected

// in constructor
char* filepath="C:\\Sample_Data\\qry_Equip.txt";
file=new ifstream(filepath);

The error I'm getting tells me that the class has no constructors - it works on the stack, but I need it on the heap as I need to maintain the pointer's position.
It would get way to mesy as a quick-fix global.

Any help massively appreciated.

Douglas JL If it don't make you laugh, it ain't true.
 
I've sussed it - it was me being an idiot.
I'd deleted an h file that had the include statement for fstream in it.
Can you beleive anyone is so dumb that they'll look for half a day before thinking to check that?
Man! If it don't make you laugh, it ain't true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top