Results 1 to 4 of 4

Thread: Function confusion

  1. #1
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Function confusion

    Hello all,

    I've got a newbie'ish question here, that's not really Qt-specific (I'd likely encounter this problem elsewhere as well).

    I'm trying to call an ioctl from within a QWidget framework. As such, I need access to the open() function (no problem), the ioctl function (no problem)... and the close(int) function (uh oh... QObject has a close() function! )

    So... close() is defined under unistd.h, and does not lie under a namespace or anything else I may use to uniquely identify it.

    Any chance there's a way for me to call this bugger from within my QObject framework? Attempting to call it makes gcc think that I'm trying to call the QWidget::close() function.
    Life without passion is death in disguise

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Function confusion

    Quote Originally Posted by KShots View Post
    Any chance there's a way for me to call this bugger from within my QObject framework? Attempting to call it makes gcc think that I'm trying to call the QWidget::close() function.
    Try with global namespace:
    Qt Code:
    1. ::close(fd);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    KShots (26th June 2007)

  4. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Function confusion

    try using the resolution operator:
    ::close().

    EDIT: damn, I was only a minute away

    Regards
    Last edited by marcel; 25th June 2007 at 21:04.

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

    KShots (26th June 2007)

  6. #4
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Function confusion

    Quote Originally Posted by jpn View Post
    Try with global namespace:
    Qt Code:
    1. ::close(fd);
    To copy to clipboard, switch view to plain text mode 
    Quote Originally Posted by marcel View Post
    try using the resolution operator:
    ::close().

    EDIT: damn, I was only a minute away

    Regards
    Thanks, that worked great.
    Life without passion is death in disguise

Similar Threads

  1. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  2. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 22:04
  3. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12:52
  4. Qt 4.1.4 plugin QPSQL
    By jcr in forum Installation and Deployment
    Replies: 4
    Last Post: 22nd June 2006, 22:55
  5. I got two problems when I used static compiled library of QT4
    By qintm in forum Installation and Deployment
    Replies: 8
    Last Post: 20th April 2006, 08: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.