Well you can redirect the standard input, output, and error streams for a program if that's what you want, but it's not C++ that does this, it is the OS.
thanks, but it not what I need because it's an assignemnt in C++.
I need to find a way in which anything written in the 'cin' buffer will be written in a file buffer
as well. I tried to assign the buffer of an fstream class to the cin buffer, but it didn't worked =\