Results 1 to 9 of 9

Thread: [Linux] /dev/ttySAC0 - how can I read that file?

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: [Linux] /dev/ttySAC0 - how can I read that file?

    Use QLocalSocket and optionally QSocketNotifier.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    Tomasz (7th November 2010)

  3. #2
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: [Linux] /dev/ttySAC0 - how can I read that file?

    Quote Originally Posted by wysota View Post
    Use QLocalSocket and optionally QSocketNotifier.
    How can I use QLocalSocket with file?

    thanks in advance
    best regards
    Tomasz

  4. #3
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: [Linux] /dev/ttySAC0 - how can I read that file?

    How about:

    Qt Code:
    1. int fd = open("/dev/ttySAC0", O_RDONLY|O_NONBLOCK);
    2. QSocketNotifier *socNotify = new QSocketNotifier(fd, QSocketNotifier::Read, this);
    3. connect(socNotify, SIGNAL(activated(int)), this, SLOT(your_read_function(int)));
    To copy to clipboard, switch view to plain text mode 

  5. The following user says thank you to squidge for this useful post:

    Tomasz (8th November 2010)

  6. #4
    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: [Linux] /dev/ttySAC0 - how can I read that file?

    Quote Originally Posted by Tomasz View Post
    How can I use QLocalSocket with file?
    /dev/ttySAC0 is not a file, it's a stream you can connect to using QLocalSocket. Or you can use QSocketNotifier with native stream handling (see the example squidge gave you).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. The following user says thank you to wysota for this useful post:

    Tomasz (8th November 2010)

Similar Threads

  1. Read from a file
    By matulik in forum Newbie
    Replies: 4
    Last Post: 26th April 2010, 19:02
  2. Read the file into
    By offline in forum Qt Programming
    Replies: 7
    Last Post: 12th April 2010, 12:11
  3. is qt phonon can read realmedia file and divx file
    By fayssalqt in forum Qt Programming
    Replies: 1
    Last Post: 27th January 2009, 15:42
  4. Replies: 1
    Last Post: 20th June 2008, 18:43
  5. Read An Xml File
    By Alienxs in forum Qt Programming
    Replies: 3
    Last Post: 5th January 2007, 00:28

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.