Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Limits on output to std::cout?
Forum Updated to NodeBB v4.3 + New Features

Limits on output to std::cout?

Scheduled Pinned Locked Moved General and Desktop
10 Posts 5 Posters 9.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      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

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          Thanks for pointing out the setting.

          1 Reply Last reply
          0
          • W Offline
            W Offline
            wrosecrans
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              • JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on last edited by
                #7

                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.

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #8

                  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.

                  1 Reply Last reply
                  0
                  • JKSHJ Offline
                    JKSHJ Offline
                    JKSH
                    Moderators
                    wrote on last edited by
                    #9

                    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.

                    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      fawzi
                      wrote on last edited by
                      #10

                      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.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved