Results 1 to 4 of 4

Thread: close() function confusion

  1. #1
    Join Date
    Oct 2008
    Location
    Thodupuzha, a small town in kerala
    Posts
    31
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default close() function confusion

    Hi masters,

    I'm trying to call an ioctl from within a QWidget framework.I am able to use open fuction , and ioctl function. But when i use close function to close the device file QWidget close function getting executed instead of close function declared in unistd.h.

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

    I have seen some one posting a thread for this problem before. The solution you people gave him was to use global namespaces , like
    :: close();
    I tried this solution , but only yielding segmentation fault. Can anyone give me another solution.

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: close() function confusion

    If you call a function f() in a context where another function of the same name is available, you have to disambiguate the two.

    You do this by prefixing the function with namespace, class or whatever you have.
    If you want to call a global function close() from inside a QWidget class, you have to write ::close() (assuming close is in the global namespace).

    How exactly did you call close()?
    You did pass a file descriptor to it?

  3. #3
    Join Date
    Oct 2008
    Location
    Thodupuzha, a small town in kerala
    Posts
    31
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: close() function confusion

    Yes ...I have passed a file descriptor to the function.
    :: close(fd);

    But it only yielded segmentation fault.

  4. #4
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: close() function confusion

    ok. show us more code, please.
    (Have you tried a debugger to check the crash is related to that close() call?)

Similar Threads

  1. QPSQL problem
    By LoneWolf in forum Installation and Deployment
    Replies: 60
    Last Post: 4th November 2009, 14:22
  2. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 12:57
  3. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 17:33
  4. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  5. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12: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.