I'm trying to createa function that takes command line arguments, parses them, and returns a stream to be used for output. If a filename is specified, the program will write to that file. If no filename is specified, the default output will be to cout.
I haven't gotten to the parsing yet. Simply passing an ostream parameter and trying to assign it to equal cout is giving me preoblems already. The error is one of those really long errors, so I won't post it unless someone wants it. I've tried making line 15 either an ostream or an ofstream. Neither works.
#include <ostream>
#include <fstream>
#include <iostream>
using namespace std;
void foo(ostream& outs)
{
outs = cout;
}
int main()
{
ofstream outs;
foo(outs);
outs << "Hello World\n";
return 0;
}