Home » Developing U++ » U++ Developers corner » evaluate command line (parse line by line processed command to create backup log)
evaluate command line [message #58686] |
Thu, 21 July 2022 22:04  |
BetoValle
Messages: 204 Registered: September 2020 Location: Brasil Valinhos SP
|
Experienced Member |
|
|
I found this code below and tested it successfully. But my intention is to evaluate the contents of each line that the mysqldump program generates. How to do this? Could someone help me with an example?
Grateful!
CONSOLE_APP_MAIN
{
std::stringstream ss;
std::string pathOfCommand ="C:\\Program Files (x86)\\MariaDB 10.1\\bin\\mysqldump.exe";
std::string params=" -u mylogin --password=mypass --verbose --extended-insert=FALSE databaseName > ";
std::string pathOfInputFile="C:\\TEMP\\file1.sql";
// some code to set values for paths and solves the filename space problem
ss << "\""; // command opening quote
ss << "\"" << pathOfCommand << "\" "; // Quoted binary (could have spaces)
ss << " " << params << " "; // Quoted input (could have spaces)
ss << "\"" << pathOfInputFile << "\""; // Quoted input (could have spaces)
ss << "\""; // command closing quote
Cout() << "seeing how the command turned out:" << ss.str() << EOL;
int i;
i=system( ss.str().c_str() );
Cout() <<"backup result: " << i << EOL;
}
|
|
|
Goto Forum:
Current Time: Sun May 11 06:42:35 CEST 2025
Total time taken to generate the page: 0.03463 seconds
|