I want to do the "vim" command, The "vim" command is used to open a new editor in linux. "setup.csh" open file "vi" editör with QProcess. I would like to run this command using gui.
linux terminal command:"vim /home/intern2/elif/Project/setup.csh" .How can I run this command gui
I wrote the following commands in Qt, but it did not work using QProcess.
QProcess *process1=new QProcess(this);
process1->start("vim" , QStringList() <<"/home/intern2/elif/Project/setup.csh");
process1->waitForBytesWritten();
process1->waitForFinished();
ui->textEdit_3->append(process1->readAllStandardOutput());
Unfortunately, I gave the following error message
Error Message:
Warning: Output is not a terminal
Warning: Input is not from a terminal
I got it working with this:
QProcess* process = new QProcess();
qint64* processId = new qint64();
process->startDetached("/usr/bin/vim", QStringList(), QString(), processId);
// Wait for process to be closed by user (kill()
// does not actually kill the process, but tests if it exists)
while (kill(*processId, 0) == 0) {}
// Done
delete processId;
delete process;
Don't forget to add #include <signal.h>
for the kill()
function.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.