Hello, I have such a question, is it possible to pass the name of a text stream as an argument to a function:

#include <fstream> #include <iostream> using namespace std; int funk(string a, int size) { // Сюда в качестве аргументa добавить output // в теле функции результат вычислений записать в output } int main() { int i, j, s; string a; ifstream input("input.txt"); ofstream output("output.txt"); getline(input, a); s = a.length(); funk(a, s); } 

Please help, and sorry if the question is stupid.

    1 answer 1

     int funk (string a, int size, ostream &output); // передаем ссылку на объект класса ostream 

    Threads are also objects.

    PS Read more about ostream .