[SOLVED] Passing an integer value in QProcess

  • Hi,
    I have written a bash script which queries my MqSQL database in a remote server. I have written several QProcess cases but those involved no input. Now i want to pass an integer value i.e the job-id to execute my bash script. When i do a

    proc->start("path/to/bash/script" , QSringList () << "a_string");

    my script doesnt run (because the passed argument is a string)

    Please help.

    [EDIT: code formatting, please wrap in @-tags, Volker]

  • Why are you using a bash script to wrap a SQL query? Why not just use QSqlQuery and friends?

  • Moderators

    Scripts only take string arguments, so I am not sure what the problem is...

    Do you need to convert a integer to a string? Check QString::number(...) for that.

  • Ok i solved it. My fault, it was simple concatenation of Qstrings.
    So now i have
    @Qstring command = "/path/to/bash/script" ;
    QString input = ui->lineEdit->text();

                        QProcess *p = new QProcess();

    Thanks for all your help.

  • as Tobias said, use "QString::number":http://doc.qt.nokia.com/4.7/qstring.html#number

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.