0
Standart input stream redirection (C++)
So I've heard it is possible to redirect the input stream to file for example. How can I do so? I've tried writing #include <iostream> #include <fstream> .....*code*..... ofstream file(data.txt); cout = file; cout << "*data*"; But it didn't compile because of line "cout = file", where it says that operator = is private. I am sure it can be done in a simular way, but I don't now how exactly... Help me please.
3 Réponses
+ 1
Oh, my bad. I meant output. Thank you for your answers! rdbuf function also works really good.