I am writing a console app.
The console print a few line. And then, I want to get the last line of content output.
How to do that?
Example:
I want to check if the last line contains: "Processing", the console app delete this line and changed "Done"
I am writing a console app.
The console print a few line. And then, I want to get the last line of content output.
How to do that?
Example:
I want to check if the last line contains: "Processing", the console app delete this line and changed "Done"
If you are writing the app, then you are in control of what is written to the console. Why would you need to capture the console output before it is printed and then change it? Just print what should be there.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
Hi, if you want to replace the last line you can use "\r" to go to the beginning of the line before printing something else.
If you really need to know what you printed last time then store it in a variable. Although I concur with d_stranz: just print the correct line.
Ginsengelf
I also need get content of console output
I have two way to print:
qDebug() << "Content";
QTextStream out(stdout); out <<"Content";
Which solution is the best for this?
Hi, qDebug won't be visible in release builds, so use the second option.
Ginsengelf
Bookmarks