Results 1 to 2 of 2

Thread: QProcess readStdOut index

  1. #1
    Join Date
    Jan 2007
    Posts
    92
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default QProcess readStdOut index

    How do I read external file that returns me the output with each index values.
    The index values are : 0 to 3;
    I want to read the output from "testFile" with index. The bash file "testFile" executes with index values like this:
    Qt Code:
    1. ./testFile 1
    2. output:-" This is my test1"
    3.  
    4. ./testFile 2
    5. output:-" This is my test2"
    6.  
    7.  
    8. ./testFile 3
    9. output:-" This is my test3"
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void CMainView::ReadFileValue()
    2. {
    3. QProcess * process;
    4. process = new QProcess(this);
    5.  
    6. //Add the argument of the process
    7. process->addArgument( "/bash" );
    8. process->addArgument ("testFile");
    9.  
    10. connect(process, SIGNAL(readyReadStdout()), this, SLOT(readTestFileOut()));
    11.  
    12. if (!process->start())
    13. {
    14. qDebug("Error with process");
    15.  
    16. }
    17. }
    18. void CMainView::readTestFileOut()
    19. {
    20. QString str = process->readStdOut();
    21. //str prints only first line i.e." This is my test1"
    22. //I want to achieve like below:-
    23. lineEdit1->setText(str1); //str1 would be This is my test1
    24. lineEdit2->setText(str2); //str2 would be This is my test2
    25. lineEdit3->setText(str3); //str3 would be This is my test3
    26.  
    27. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess readStdOut index

    Can't re-use the index that you pass as an argument to that process?

Similar Threads

  1. Qtopia core 4.2.2 cross compile make error
    By smiyai18 in forum Installation and Deployment
    Replies: 2
    Last Post: 28th August 2007, 17:04
  2. QProcess and Pipes
    By KaptainKarl in forum Qt Programming
    Replies: 1
    Last Post: 9th April 2007, 23:11
  3. QProcess extremely slow on Windows?
    By Pepe in forum Qt Programming
    Replies: 2
    Last Post: 26th March 2007, 00:25
  4. QProcess / system call not working under linux. Why?
    By johnny_sparx in forum Qt Programming
    Replies: 12
    Last Post: 11th March 2006, 00:32
  5. speed up qprocess readstdout
    By kooshball in forum Qt Programming
    Replies: 1
    Last Post: 31st January 2006, 09:42

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.