Results 1 to 7 of 7

Thread: stdin reading

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: stdin reading

    why not use cin and `operator >> ` ?

    for the socket trick you have to make sure the buffer is not used. I didn't know that trick was linux only.

    you can try this,
    Qt Code:
    1. QTextStream qtin(stdin);
    2. QString line = qtin.readLine(); // This is how you read the entire line
    3.  
    4. QString word;
    5. qtin >> word; // This is how you read a word (separated by space) at a time.
    To copy to clipboard, switch view to plain text mode 
    as suggested here http://stackoverflow.com/questions/2...use-cin-and-qt
    Last edited by amleto; 26th July 2012 at 23:54.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  2. The following user says thank you to amleto for this useful post:

    gmc (26th July 2012)

Similar Threads

  1. Write to QProcess from stdin
    By rajji_saini in forum Newbie
    Replies: 2
    Last Post: 24th October 2011, 18:45
  2. QProcess and stdin
    By ithinkso in forum Newbie
    Replies: 7
    Last Post: 23rd May 2011, 06:21
  3. Replies: 0
    Last Post: 2nd August 2010, 09:17
  4. Looking to NOT echo input when writing to stdin
    By ultim8 in forum Qt Programming
    Replies: 1
    Last Post: 19th June 2009, 21:57
  5. IPC / reading stdin within non-GUI thread
    By mule in forum Qt Programming
    Replies: 3
    Last Post: 29th November 2007, 22:11

Tags for this Thread

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.