I'm trying to make a class that takes the argv parameters and creates various ifstreams and ofstreams with it (and also redirects cout, clog and cerr if the right commands are given in the argv).
But I have not been abble to sucessfully make my functions return the stream (I don't really have a lot of experience with streams).
So one example of this would be this function:
Code:
ifstream& ccinterface::no_cc_msg() {
//if no commands were given explains how to use console commands
// and asks the user for the input file
help();
cout<<"Alternatively you may define the input file here (all other specifications"<<endl
<<"will be regarded has defaulf if you have not defined them):"<<endl;
string input_str;
cin>>input_str;
ifstream input(input_str.c_str());
return input;
}
that I would then like to store the result in my input variable there:
Code:
//(...constructor...)
if (argc==1) input(no_cc_msg());
}
private:
ifstream input;
void help();
ifstream& no_cc_msg();
//(...)
I'm guessing my problem is on how i'm trying to assign the data to the stream but I've tried a few ways and haven't figured out the correct way to do it.
tks in advance for any help i get