简体   繁体   English

如果与QProcess一起传递,则参数无法识别

[英]Argument doesn't recognized if passed with QProcess

I have difficult to pass the -vo argument to mplayer using QProcess , Here a minimal example: 我很难使用QProcess-vo参数传递给mplayer,这是一个最小的示例:

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QString program;
    program = "C:\\mplayer-svn-38008\\mplayer.exe";

    QStringList arguments;
    arguments << "-vo gl" << "C:\\test.mp4"; 

    QProcess *m_process = new QProcess(this);
    m_process->start(program, arguments);
}

The process outputs: 该过程输出:

Unknown option on the command line: -vo gl 命令行上的未知选项:-vo gl

using the same argument on Windows shell leads to the correct behavior: 在Windows Shell上使用相同的参数会导致正确的行为:

>mplayer -vo gl C:/test.mp4

Also, removing that argument from the QStringList works. 同样,从QStringList删除该参数也可以。 Why the -vo option is recognized from command line but not from QProcess ? 为什么从命令行识别-vo选项而不从QProcess识别?

您必须分隔每个由空格分隔的参数:

arguments << "-vo"<< "gl" << "C:\\test.mp4"; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM