Original Post
I have a function that dumps some details that I would like to write to a file. Currently the function directs all its output to cout and my ofstream is not available to the function. My approach to the problem was as follows:
Firstly redeclare the function so that it returns an ostream:
std::ostream mbsGType::DumpActions()
Next declare and ostream within the function and use it as the return value:
ostream Return;
Return << " Moves made: ";
Return.width(3);
Return << NumActions;
...
return Return;
My thinking was that I could then call the function as follows:
cout << objgtype->DumpActions();
However, the compiler does not like my declaration of Return.
Is this the right approach to solving this problem? If so, why does the declaration of Return not work?
Thanks,
Garvin.