I'm trying to make a script that utilizes the command line for displaying data, and I want to be able to log everything that outputs to the command line into a separate file.
I'm using fstream, iostream, and std namespace. I just need to know how to reference the the command line CmdExample.exe and everything it's says to write it to a txt file.
Example:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
cout << "This is some text I want to reference when the program ends" << endl << "and write to a txt file.";
return 0;
}