Shlainn
19th September 2006, 08:14
Hi all,
I have and external mySQL C API program which needs to receive the data to search for in the database.
The following code displays the connection to the Qprocess and it works fine
void DatabaseLogin::connectAccept()
{
proc = new QProcess( this );
QLabel *label = new QLabel("tester",0);
label->show();
QDir *directoryPath = new QDir("f:/projek/Functional_units/Database_sources/files");
proc->setWorkingDirectory(*directoryPath);
// Set up the command and arguments.
proc->addArgument( "cmd" );
proc->addArgument( "/c" );
proc->addArgument( "fdatabase" );
proc->addArgument( "epr" );
proc->start();
connect( proc, SIGNAL(readyReadStdout()),
this, SLOT(readFromStdout()) );
if ( !proc->start() )
{
// error handling
QMessageBox::critical( 0,
tr("Fatal error"),
tr("Could not start the program."),
tr("Quit") );
exit( -1 );
}
}
void DatabaseLogin::readFromStdout()
{
// Read and process the data.
// Bear in mind that the data might be output in chunks.
output->append( proc->readStdout() );
}
please note that ouput is just the verify the results obtained, so the program is called fdatabase and one of the variables are the database called epr. I can't send the field to look for using the above method because the API run differently to another program.
In the API I have scanf and thus from the QT3 I want to write to stdIn any advise/questions? When I add
proc->writeToStdin("1123"); just after the start nothing wants to work :(
Please help!
Thanks :)
I have and external mySQL C API program which needs to receive the data to search for in the database.
The following code displays the connection to the Qprocess and it works fine
void DatabaseLogin::connectAccept()
{
proc = new QProcess( this );
QLabel *label = new QLabel("tester",0);
label->show();
QDir *directoryPath = new QDir("f:/projek/Functional_units/Database_sources/files");
proc->setWorkingDirectory(*directoryPath);
// Set up the command and arguments.
proc->addArgument( "cmd" );
proc->addArgument( "/c" );
proc->addArgument( "fdatabase" );
proc->addArgument( "epr" );
proc->start();
connect( proc, SIGNAL(readyReadStdout()),
this, SLOT(readFromStdout()) );
if ( !proc->start() )
{
// error handling
QMessageBox::critical( 0,
tr("Fatal error"),
tr("Could not start the program."),
tr("Quit") );
exit( -1 );
}
}
void DatabaseLogin::readFromStdout()
{
// Read and process the data.
// Bear in mind that the data might be output in chunks.
output->append( proc->readStdout() );
}
please note that ouput is just the verify the results obtained, so the program is called fdatabase and one of the variables are the database called epr. I can't send the field to look for using the above method because the API run differently to another program.
In the API I have scanf and thus from the QT3 I want to write to stdIn any advise/questions? When I add
proc->writeToStdin("1123"); just after the start nothing wants to work :(
Please help!
Thanks :)