It is necessary to output all processes in textedit in qtcreator in Linux. I understand that for this you need to open the file / bin / ps, but knocks an error. no matching function for call to 'QTextEdit :: append (QFile &)' ui-> textEdit-> append (file); ^ How to read the contents of the file?

} QFile file("/bin/ps"); file.isOpen(); ui->textEdit->append(file); } 

    1 answer 1

      QFile file("/bin/ps"); if (file.open(QIODevice::ReadOnly)) { QString temp(file.ReadAll()); ui -> textEdit -> append(temp); } 
    • error: no matching function for call to 'QFile :: isOpen (QIODevice :: OpenModeFlag)' if (file.isOpen (QIODevice :: ReadOnly)) ^ - Andrey
    • Replace file.IsOpen with file.open - Aquinary
    • I'm a little confused. ps - this is, as I understand it, all the processes in Linux. I need to bring all these processes to textedit. It normally outputs to the console, and an error in textedit that you cannot convert from int to string. - Andrey
    • That's right. ps is not a separate text file, but a utility. To get a file with a list of processes, you need to use the following command: / bin / bash -c "/ bin / ps aux> / path / to / output / file" - Aquinary
    • You can also use the solution provided on this resource: askubuntu.com/questions/522640/… - Aquinary