Results 1 to 7 of 7

Thread: How to read CD with read?

  1. #1
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question How to read CD with read?

    Hi All,

    I m using Qt 4.1.5 on my MAC.
    I am using the following code to read the HardDisk or any other Drive.

    Qt Code:
    1. fileDescriptor = open ( DriveName, O_RDONLY );
    2. lseek(fileDescriptor,(off_t) SectNo*SECTSIZE, SEEK_SET);
    3. numBytes = read( fileDescriptor, Buffer, Size );
    To copy to clipboard, switch view to plain text mode 

    where for disk I have Drive Name as /dev/rdisk0.

    But if I read CD by the above code it is returning non negative value in fileDescriptor and lseek also working right but in the read function is is returning -1.


    If some one know why it is not working with CD then plz help me.


    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to read CD with read?

    Do you want to read files or the raw ISO? Reading from /dev/cdrom or similar should work fine... Provided you have permissions to do that.

  3. #3
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Re: How to read CD with read?

    Thanks for Reply.

    Actually I want to read raw ISO.

    I think I have permission because when I open the CD with
    fileDescriptor = open ( DriveName, O_RDONLY );
    it return 14 that it is opening the file but problem is when I read the disk it is returning -1.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to read CD with read?

    Is the disk mounted at that time?

  5. #5
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Re: How to read CD with read?

    Yes. It is showing it in the Finder and I can see the Conetnts of it.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to read CD with read?

    Can you unmount it and try again?

  7. #7
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to read CD with read?

    Thanks.

    Now I m able to do it.

    Actually I m reading from disk by adding r before disk as /dev/rdisk0 but to CD I have just have to read like /dev/disk2.

    Thanks for Reply.

Similar Threads

  1. Replies: 2
    Last Post: 23rd June 2007, 09:13
  2. QIODevice read()
    By ShaChris23 in forum Newbie
    Replies: 1
    Last Post: 3rd May 2007, 00:29
  3. How to Read and display BMP image using QT
    By agsrinivasan in forum Qt Programming
    Replies: 3
    Last Post: 29th January 2007, 07:14
  4. How to read line from file
    By Krishnacins in forum Newbie
    Replies: 10
    Last Post: 1st June 2006, 23:14
  5. Replies: 13
    Last Post: 1st June 2006, 14:01

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.