I have a class called manifest...
class manifest {
public:
manifest();
manifest(const char *filename);
~manifest();
void report_name();
private:
char* select(char *filename, int len);
char *filename;
ifstream *mstreamp;
};
...manifest is initialized by one of the following constructors...
manifest::manifest(){
filename = new char[FILENAME_MAX];
while (!select(filename, FILENAME_MAX - 1));
mstreamp = new ifstream(filename);
}
manifest::manifest(const char* manfile){
filename = new char[FILENAME_MAX];
strncpy(filename, manfile, FILENAME_MAX - 1);
mstreamp = new ifstream(filename);
}
How do I handle errors in opening the ifstream?
Is it a good idea perhaps, to just allocate space for filename within
the constructor and then handle everything else in a manifest::init()
member? That would seem redundant to me but perhaps overloading
constructors is already redundant.
Any help would be greatly appreciated. thanx
*A fool must search for a greater fool to find admiration.
e-mail: benjamin.l.mcgee@purgatoire.org
NET-MAIL: Benjamin L McGee on 1:15/7
--- FLAME v1.1
---------------
* Origin: Purgatoire BBS, 719-846-0140, Trinidad, CO, V.34 (1:15/7)
|