Unsolved QProcess with psql in linux
-
Hello everyone, I'm having a problem executing a command to load the database using QProcess.
QStringList cmd;
QString programa = "psql";
cmd << QString("psql -d DBName < %1 ").arg(filePathAndName);
QProcess process;
process.start(programa, cmd);
process.waitForFinished();
qDebug()<<"out"<<process.readAll();What is wrong with my execution?
-
Hi and welcome to devnet,
Your
cmd
variable content is wrong. Each parameter of the process should be passed as a separate instance.
Also, why do you have cmd twice in the code base ?