Results 1 to 3 of 3

Thread: List the output of ls /dev/tty* using QProcess

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2008
    Location
    France
    Posts
    93
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android
    Thanked 23 Times in 22 Posts

    Default Re: List the output of ls /dev/tty* using QProcess

    QProcess run a process and not a shell so the * wilcard does not work.
    This will work, but it's ugly
    Qt Code:
    1. QProcess* process = new QProcess();
    2. process->start("sh -c \"ls /dev/tty*\"");
    3. process->waitForFinished(-1);
    4. qDebug() << process->readAllStandardOutput();
    5. qDebug() << process->readAllStandardError();
    To copy to clipboard, switch view to plain text mode 
    This is better :
    Qt Code:
    1. QDir lsDev("/dev/");
    2. lsDev.setNameFilters(QStringList() << "tty*");
    3. qDebug() << lsDev.entryList(QDir::System);
    To copy to clipboard, switch view to plain text mode 

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

    arunkumaraymuo1 (3rd September 2013)

Similar Threads

  1. Replies: 1
    Last Post: 3rd June 2013, 14:11
  2. Cleaned event list of main app, when qprocess finished.
    By alnorte in forum Qt Programming
    Replies: 2
    Last Post: 1st March 2013, 11:53
  3. Replies: 4
    Last Post: 15th June 2012, 00:33
  4. Replies: 1
    Last Post: 23rd April 2011, 18:33
  5. List View with sections for alphabetialy sorted list
    By woodtluk in forum Qt Programming
    Replies: 4
    Last Post: 12th October 2010, 12:50

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.