GUI command prompt


My apologies again. I will try to clarify. I would like to have any printf or cout statement print to a text box in real time. The solution you gave me earlier (redirecting to a text file) partially works because it takes any printf or cout statement and prints it to the TGTextView. The issue I discovered is that it does not print in real time. For example:

gSystem->RedirectOutput("textfile.txt", "a"); for (int i = 0; i < 8; i++) { cout << "Round " << i << endl; } fTextView->LoadFile(textfile.txt);
This text box will only display the cout statements after the for loop has completed. I would like the text box to show each cout statement as it is executed. I hope the nuance makes sense. Thank you again.


So yes, in this case, you can create a class inheriting from TGTextView and std::ostream. But I think you would still have to replace all your calls to cout << "Round " << i << endl; with something like: *fTextViewOStream << "Round " << i << endl;
Cheers, Bertrand

Okay, thank you. I will explore that though unfortunately it may still not work if I have to replace the cout statements. I apologize for the confusion and thank you for your patience. :smiley: