I'm trying to take a program that takes in various of output from the program console and wanted to be able to process it later on. Also I have tried researching this myself but most keep the buffer on making it impossible to print after. It also doesn't matter if you have to print to a file either. I also want to read the files like the output, Line by line.
using namespace std;
sbuffer;//This would be the code to capture the c++ console output
cout << "This is a test sentence" << endl;
cout << "Second sentence" << endl;
cout << "Third" << endl;
sbuffer.close() //close the buffer
read = sbuffer
for(int i = 0; i < read.length(); i ++){
print(read[i]) // prints out each line.
}