【发布时间】:2013-03-14 16:45:32
【问题描述】:
我在 ubuntu 中使用 Qt 5.0.1(64 位)。 我在按钮按下功能下运行以下命令。
QString command = "sh /home/rahul/qtapp/ques_new/ques_new/inter4ql/test1.sh"; const char* command2;
command2 = command.toLocal8Bit().data();
系统(命令2);
test1.sh文件内容是
!/bin/bash
回声“你好” 回声“你好”>> out.txt
按下按钮调用此系统命令时,它在输出窗口中显示 hello,但不会创建新文件 out.txt。
为了调试,我在调用此函数之前手动创建了 out.txt。但是,再次调用此函数后,它会在输出窗口中显示 hello,但不会将 hello 放入 out.txt。
【问题讨论】: