Limits on output to std::cout?
-
In my application I output text into standard output stream (std::cout) for debugging purposes. When debug version runs under Qt Creator I can see the the text in Application Output window. However I discovered that there is a limit on how much I can output. After a few hundred lines output stops showing up. It looks like there is a limit on how much I can print. Is there a way to increase this limit?
-
Hi,
I've tried this code
@
#include <iostream>
#include <unistd.h>using namespace std;
int main()
{
for (int i = 0; i < 100; ++i) {
for (int j = 0; j < 100; ++j)
std::cout << (i * 100) + j << " --> Hello" << std::endl;sleep(1); } return 0;
}
@and all works.
EDIT.
In Build&Run options page you find Limit application output to xxxx lines spin -
I don't know. May be the limit is not on the number of lines but the number of characters. Try longer and varying lines.
Apparently I am not the only one experiencing this problem. For example "follow this link":http://developer.nokia.com/community/discussion/showthread.php/223227-Way-to-increase-max-size-of-Application-Output-scroll-under-QtCreator -
Thanks for pointing out the setting.
-
You can also just run the application outside of Qt Creator. The limit isn't anything to do with stdout, it's purely an issue of how much text Qt Creator will display. If you want to run the program directly, you can dump gigabytes out of stdout.
-
My struggle with QtCreator continues. Despite increasing the setting on max number of output lines and max length of strings QtCreator still cuts off output streams prematurely. This happens with both std::cout and std::cerr. Looks like I am going to be forced to resort to redirecting standard outputs to my file.
-
Hi,
[quote author="LRaiz" date="1401156782"]In my application I output text into standard output stream (std::cout) for debugging purposes.[/quote]I don't know why there seems to be a limit on std::cout, but you could replace std::cout with qDebug() instead. Just #include <QDebug> to use it.
I've never had problems with QDebug, even after hundreds of lines.
-
Despite my hopes QDebug didn't not do the job either.
I need to output standard strings, not QStrings, so in my debug outputting utility I wrote
@qDebug() << QString::fromStdString(message);@Unfortunately the output in QtCreator Application Window still stopped after 9000 words / 67000 characters (don't know number of lines). It also introduced a new problem because each output string became enclosed in double quotes which I did not want.
-
I guess redirecting to a file is currently your best option then.
[quote author="LRaiz" date="1401197534"]Apparently I am not the only one experiencing this problem. For example "follow this link":http://developer.nokia.com/community/discussion/showthread.php/223227-Way-to-increase-max-size-of-Application-Output-scroll-under-QtCreator[/quote]I just read this link. Perhaps there's a deliberate limit coded into Qt Creator, to avoid excessive memory use.
If you subscribe to the "Qt Creator mailing list":http://lists.qt-project.org/mailman/listinfo/qt-creator and ask there, you should get insight from one of the engineers who work on Qt Creator.
-
I looked at this and could not reproduce your issue with a recent QtCreator, even setting a limit just limits how much you can scroll back, it never suppresses new output, and you can always tick Run in terminal in the Projects>Run pane.
Try opening a bug with a program that shows your issue, so that we can reproduce it.