Ok added the "\n":
Qt Code:
  1. proc->addArgument( username );
  2. proc->addArgument( database );
  3. output->append( (proc->arguments()).join(" "));
  4. proc->start();
  5.  
  6. proc->writeToStdin("Saurabh\n");
  7. connect( proc, SIGNAL(readyReadStdout()),
  8. this, SLOT(readFromStdout()) );
  9.  
  10. if ( !proc->start() )
  11. {
To copy to clipboard, switch view to plain text mode 

But still nothing. Here is the .c code:
Qt Code:
  1. int SetQuery()
  2. { char query[1024];
  3. char serialnmr[20];
  4. //char *serialnmr;
  5. //serialnmr = "Saurabh";
  6. printf("input");
  7. scanf("%s",serialnmr);
  8.  
  9. printf("%s\n",serialnmr);
  10. sprintf(query, "SELECT * FROM users WHERE name='%s'",serialnmr);
To copy to clipboard, switch view to plain text mode 

The .c works in the command line but using QT3 it doesn't want to work.