QProcess Mac OS ,无法启动带有参数的可执行文件
QProcess Mac OS , Cant launch executable with arguments
/usr/local/bin/rdesktop 从终端启动将我连接到主机
以下启动不带参数的 rdesktop:
QString program = "/usr/local/bin/rdesktop";
QStringList args;
QProcess *process = new QProcess(this);
args << m_address;
process->start("open \""+program);
process->setArguments(args);
尝试过相同的结果:
process->startDetached("open \""+program);
process->execute("open \""+program);
还有参数重载 func process.start("open \""+program, args)
它没有启动任何东西,也没有错误消息。
有什么建议吗?
...
process->start("open \""+program);
process->setArguments(args);
由于您是在调用 QProcess::start 之后设置参数,因此在启动所需程序时进程将不会收到参数。
如 QProcess::setArguments 的文档所述
Set the arguments to pass to the called program when starting the process. This function must be called before start().
工作...
QProcess *process = new QProcess(this);
QString 程序 = "/usr/local/bin/rdesktop";
QStringList 参数;
参数 << m_address;
进程->设置程序(程序);
进程->setArguments(args);
进程->开始();
/usr/local/bin/rdesktop 从终端启动将我连接到主机
以下启动不带参数的 rdesktop:
QString program = "/usr/local/bin/rdesktop";
QStringList args;
QProcess *process = new QProcess(this);
args << m_address;
process->start("open \""+program);
process->setArguments(args);
尝试过相同的结果:
process->startDetached("open \""+program);
process->execute("open \""+program);
还有参数重载 func process.start("open \""+program, args) 它没有启动任何东西,也没有错误消息。
有什么建议吗?
...
process->start("open \""+program);
process->setArguments(args);
由于您是在调用 QProcess::start 之后设置参数,因此在启动所需程序时进程将不会收到参数。
如 QProcess::setArguments 的文档所述
Set the arguments to pass to the called program when starting the process. This function must be called before start().
工作...
QProcess *process = new QProcess(this);
QString 程序 = "/usr/local/bin/rdesktop";
QStringList 参数;
参数 << m_address;
进程->设置程序(程序);
进程->setArguments(args);
进程->开始();