Results 1 to 4 of 4

Thread: Qt c++ open && ioctl

  1. #1
    Join Date
    Aug 2015
    Posts
    8
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Qt c++ open && ioctl

    Hi i need some help

    Qt Code:
    1. if((fd = open("/dev/sda",O_RDONLY)) < 0)
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. if((err = ioctl(fd,HDIO_GET_IDENTITY,&hd)) < 0)
    To copy to clipboard, switch view to plain text mode 

    headers
    Qt Code:
    1. #include <linux/types.h>
    2. #include <linux/hdreg.h>
    3. #include <linux/fcntl.h>
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. error: 'open' was not declared in this scope
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. error: 'ioctl' was not declared in this scope
    To copy to clipboard, switch view to plain text mode 

    What's the problem ?


    Added after 1 33 minutes:


    up up up up up up
    Last edited by BuranereLoo; 24th August 2015 at 18:47.

  2. #2
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    120
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt c++ open && ioctl

    Hello,

    try the following includes:
    Qt Code:
    1. #include <sys/types.h>
    2. #include <linux/hdreg.h>
    3. #include <sys/ioctl.h>
    4. #include <fcntl.h>
    To copy to clipboard, switch view to plain text mode 

    Regards
    ars

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

    BuranereLoo (24th August 2015)

  4. #3
    Join Date
    Aug 2015
    Posts
    8
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Qt c++ open && ioctl

    Okay it's work thanks for answer ars

  5. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt c++ open && ioctl

    The required headers for system calls are documented in Section 2 of the manual pages
    Qt Code:
    1. $ man 2 open
    2. $ man 2 ioctl
    To copy to clipboard, switch view to plain text mode 

    You might also learn patience, especially since you are asking a generic C programming question in a Qt-specific forum.

Similar Threads

  1. Replies: 2
    Last Post: 25th September 2014, 07:50
  2. Getting Storage Bus Type(SCSI/ATA/ etc) before using IOCTL
    By Ryuuji in forum General Programming
    Replies: 0
    Last Post: 20th March 2013, 05:31
  3. How to use IOCTL calls with QT?
    By augusbas in forum Qt Programming
    Replies: 3
    Last Post: 15th November 2010, 07:55
  4. Replies: 3
    Last Post: 25th August 2010, 12:39
  5. Why QSqlDatabase::open() returns open?
    By gboelter in forum Newbie
    Replies: 7
    Last Post: 27th August 2009, 18: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.