Search code examples
c++qtterminalconsoleqt-creator

Qt6 How to clear internal terminal of QtCreator from C++?


Qt6 How to clear internal terminal of QtCreator from C++ without using Qt?
system("cls"); and system("clear"); does not work.
Terminal outputs: "TERM environment variable not set." for system("clear");
and
"sh: line 1: cls: command not found" for cls.


Solution

  • See https://bugreports.qt.io/browse/QTCREATORBUG-30737 for a bug report regarding this exact issue.

    Qt Creator 13.0.1 has a fix, or you can workaround by giving the TERM environment variable the proper value.

    $ export TERM=xterm-256color