Results 1 to 3 of 3

Thread: QProcess' writeToStdin

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QProcess' writeToStdin

    Quote Originally Posted by Shlainn View Post
    When I add
    Qt Code:
    1. proc->writeToStdin("1123");
    To copy to clipboard, switch view to plain text mode 
    just after the start nothing wants to work
    Add a newline ("\n") to the string you send.

  2. #2
    Join Date
    Sep 2006
    Posts
    4
    Thanks
    2
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: QProcess' writeToStdin

    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.

Similar Threads

  1. problem with qprocess
    By deekayt in forum Qt Programming
    Replies: 2
    Last Post: 13th June 2006, 13:30
  2. QProcess start automaticaly needed application
    By raphaelf in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2006, 14:11
  3. Replies: 4
    Last Post: 13th February 2006, 11:35
  4. speed up qprocess readstdout
    By kooshball in forum Qt Programming
    Replies: 1
    Last Post: 31st January 2006, 09:42
  5. QProcess in a QThread
    By chombium in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2006, 15:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.