Results 1 to 12 of 12

Thread: open large file in qt?

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

    Question open large file in qt?

    Hi All,

    I m using Qt 4.1.5 on my Mac Tiger.
    I want to open my HardDisk as file in qt.
    I m using QFILE for that but it is working only on small size when I m opening Hardisk of 160 GB the open function return false.


    If anybody knows how I can open large file then plz help me.

    Thanks.

  2. #2
    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: open large file in qt?

    The "HardDisk" is actually the root of the filesystem( "/" ). Therefore you cannot open it as a file.

    What are you trying to do? Compress it, back it up?
    Whatever you want, you must use 64 bytes for file sizes and offsets because the result will get pretty big.

    Regards

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

    Question Re: open large file in qt?

    Thanks for reply.

    Quote Originally Posted by marcel View Post
    Whatever you want, you must use 64 bytes for file sizes and offsets because the result will get pretty big.
    How can I use 64 bytes for file sizes?
    open64 function is not there in the Mac.

  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: open large file in qt?

    I think he means something like /dev/hda which is the harddisk itself.

    First of all try checking if you have all required permissions to do that, for example if you can open the file as a regular user using something like hexedit or simmilar.

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

    Question Re: open large file in qt?

    Thanks for Reply.

    Ya I just want to open file like /dev/rdisk0 from the qt application and I have all the permission for that but donot know how to open it on Mac.

  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: open large file in qt?

    It works for me on Linux (I have to be root to do that though):
    Qt Code:
    1. #include <QFile>
    2.  
    3.  
    4. int main(){
    5. QFile file("/dev/hda");
    6. if(!file.open(QFile::ReadOnly)){
    7. qDebug("FAILED");
    8. } else {
    9. qDebug("OPENED");
    10. }
    11. return 0;
    12. }
    To copy to clipboard, switch view to plain text mode 

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

    Question Re: open large file in qt?

    This function always return false on My MAC.

  8. #8
    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: open large file in qt?

    What does Get Info in Finder has to say about /dev?
    I mean, do you have any permissions at all?

  9. #9
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: open large file in qt?

    Quote Originally Posted by marcel View Post
    What does Get Info in Finder has to say about /dev?
    I mean, do you have any permissions at all?
    Normal ist /Volumes

    Qt Code:
    1. #if defined Q_WS_MAC
    2. /* apple + K */
    3. label_webdav->setText(tr("Mac OS: Mount Disk Webdav Root"));
    4. QString listdiron ="/Volumes/";
    5. webdav_root->addItem(disksetting);
    6. /* webdav_root->addItem(listdiron);*/
    7. QDir dir(listdiron);
    8. if (dir.exists()) {
    9. const QFileInfoList list = dir.entryInfoList();
    10. for (int i = 0; i < list.size(); i++)
    11. {
    12. fi = list.at(i);
    13. if (fi.isDir() && fi.fileName() != "." && fi.fileName() != "..") {
    14. QString disker = fi.absoluteFilePath();
    15. QString diskeree = disker.append("/");
    16. webdav_root->addItem(diskeree);
    17. }
    18. }
    19. }
    20. webdav_root->setEditable(false);
    21. #endif
    To copy to clipboard, switch view to plain text mode 

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

    Question Re: open large file in qt?

    Thanks for Reply.

    But Actually I want to open the HardDisk not to read Dir or File Actually I have to Read the Bytes from the HardDisk.
    I have a function to do that but Actually It can not able to open the file. I have also used c function open("/dev/rdisk0",O_RDONLY) but it also not able to open the Drives.

    It is showing that it has read write permission when I see from Getinfo in finder.
    Actually I have tried on other system but it doesnot work.

    It is working when I open a removable media but not in case of Hard disk.

  11. #11
    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: open large file in qt?

    What does ls -l /dev/rdisk0 return?

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

    Question Re: open large file in qt?

    Hey guys I got it.
    Actually I am login as admin but it have some file system permission to root user.

    So I just enabled user root and now it is running correctly.

    Guys Thanks for reply.

Similar Threads

  1. QDesktopServices open url & local file & pdf or doc
    By patrik08 in forum Qt Programming
    Replies: 9
    Last Post: 14th April 2012, 04:42
  2. Restrict user to open the same file
    By vermarajeev in forum General Programming
    Replies: 33
    Last Post: 25th May 2007, 08:15
  3. How to open a Pdf file from Qt
    By vishal.chauhan in forum Newbie
    Replies: 2
    Last Post: 28th March 2007, 08:24
  4. Qt 4.1.4 on VS2005 error- cannot open input file 'qtmain.lib'
    By Ashish in forum Installation and Deployment
    Replies: 10
    Last Post: 11th October 2006, 16:05
  5. QProcess open all file -> url.dll,FileProtocolHandler
    By patrik08 in forum Qt Programming
    Replies: 2
    Last Post: 26th June 2006, 17:07

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.