angelehnt an http://www.qtforum.de/forum/viewtopic.p ... ut&start=0
habe ich versucht den output von mysqldump in eine Datei zu schreiben.
Code: Alles auswählen
if (!file.open(QIODevice::WriteOnly ) )
return;
QDataStream outfile(&file);
QStringList output;
QProcess *process = new QProcess();
QString cmd= "/usr/local/mysql/bin/mysqldump";
QStringList args;
args << " --single-transaction DB -uuser -ppasswd -h host";
std::cout<<"try to open: "<<cmd.toStdString()<<std::endl;
process->start(cmd, args);
if (!process->waitForStarted() )
std::cout<<"process couldn't get opened"<<std::endl;
// wait for finishing of the process
process->waitForFinished();
QTextStream *txt_stream = new QTextStream(process);
while(!txt_stream->atEnd() )
{
std::cout<<"read output: ";
QString tmp_str = txt_stream->readLine();
output.append(tmp_str);
std::cout<<tmp_str.toStdString()<<std::endl;
if(txt_stream->atEnd() )
{
process->close();
std::cout<<"process finished: "<<std::endl;
outfile << output;
}
}Muss ich da noch irgendwo zwischenpuffern?