This is my entire code. I seams pg_dump received all my parameters, but something was missed and it returned error. Note that I am using the full path of to pg_dump. Yhis _database objectc gives the all information about the database I want to backup :


Qt Code:
  1. string host = _database->host().empty() ? "localhost" : _database->host();
  2. int port = _database->portNumber() == 0 ? 5432 : _database->portNumber();
  3. string path = "C:\\Arquivos de programas\\PostgreSQL\\8.2\\bin";
  4. string backupExe = "\"" + path + "\\pg_dump.exe\"";
  5. string fileName = string(fileLineEdit->text().latin1());
  6. string envPassword = "PGPASSWORD=" + _database->password();
  7.  
  8. if(!_process)
  9. {
  10. _process = new QProcess(0);
  11. connect(_process, SIGNAL(readyReadStdout()), this, SLOT(readFromStdout()));
  12. connect(_process, SIGNAL(readyReadStderr()), this, SLOT(readFromStderr()));
  13. }
  14. QDir dir(path.c_str());
  15. _process->setWorkingDirectory(dir);
  16.  
  17. _process->clearArguments();
  18. _process->addArgument(backupExe.c_str());
  19. _process->addArgument("-i");
  20. _process->addArgument("-h");
  21. _process->addArgument(host.c_str());
  22. _process->addArgument("-p");
  23. _process->addArgument(Te2String(port).c_str());
  24. _process->addArgument("-U");
  25. _process->addArgument(_database->user().c_str());
  26. _process->addArgument("-Fc");
  27. _process->addArgument("-b");
  28. _process->addArgument("-v");
  29. _process->addArgument("-f");
  30. _process->addArgument(fileName.c_str());
  31. _process->addArgument(_database->databaseName().c_str());
  32.  
  33. QStringList* strList = new QStringList();
  34. strList->append(envPassword.c_str());
  35.  
  36. if(!_process->start(strList))
  37. {
  38. QMessageBox::information(this, "Information", "Error starting process");
  39. }
To copy to clipboard, switch view to plain text mode 

Thanks

--------------------------------------------------------------------------------

Obs: I am using QT 3.2.0