Hi im trying to run a simple QProcess, here is my very basic code.
QDir("/home/brett/sweetback");
QProcess process;
process.start("mysqldump -uroot -ppass sweetassurfwear > sweetassurfwear.sql");
process.waitForFinished(-1);
What is wrong with this? I have chaged the code to this
QString program = "/usr/bin/mysqldump";
QStringList arguments;
arguments << "-uroot";
arguments << "-ppass";
arguments << "--routines";
arguments << "sweetassurfwear > sweetassurfwear.sql";
//All the other arguments
QProcess *myProcess = new QProcess(parent);
myProcess->start(program, arguments);
Im now getting the error
sweetgui2.cpp: In member function ‘void SweetGuiForm::on_buttonBox_accepted()’:
sweetgui2.cpp:88: error: no matching function for call to ‘QProcess::QProcess(<unresolved overloaded function type>)’
/usr/include/QtCore/qprocess.h:219: note: candidates are: QProcess::QProcess(const QProcess&)
/usr/include/QtCore/qprocess.h:129: note: QProcess::QProcess(QObject*)
make: *** [sweetgui2.o] Error 1
I have changed the line
QProcess *myProcess = new QProcess(parent);
to
QProcess *myProcess = new QProcess(this);
It now compiles but im still not getting a dump file
Change the following line:
arguments << "sweetassurfwear > sweetassurfwear.sql";
to:
arguments << "sweetassurfwear" << ">" << "sweetassurfwear.sql";
You need to handle the different strings as separate arguments.