Results 1 to 5 of 5

Thread: How to set permissions to a file using QFile::setPermissions()

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    4
    Thanked 1 Time in 1 Post

    Smile How to set permissions to a file using QFile::setPermissions()

    Hi, everybody. I have a problem when working with file permissions. When I create a file, its default permissions are -rw-r--r-- and now i want to add execute permission to this file. This mean its permissions must be -rwxr-xr-x. So I used these commands:

    Qt Code:
    1. QString savefile = QFileDialog::getSaveFileName(this,"Save File", QDir::currentPath(),fillter0) + ".desktop";
    2. QFile myfile(savefile);
    3. myfile.setPermissions(QFile::ExeGroup);
    4. myfile.setPermissions(QFile::ExeOther);
    5. myfile.setPermissions(QFile::ExeOwner);
    6. myfile.setPermissions(QFile::ExeUser);
    To copy to clipboard, switch view to plain text mode 

    But it doesnt work. May you help me find a solution for this. Thank you very much.
    Last edited by g16bit; 17th March 2011 at 15:17.

Similar Threads

  1. Replies: 3
    Last Post: 28th March 2009, 16:37
  2. QFile can't read a file
    By Raccoon29 in forum Qt Programming
    Replies: 3
    Last Post: 11th February 2009, 21:24
  3. Replies: 1
    Last Post: 27th September 2008, 21:12
  4. Replies: 3
    Last Post: 11th September 2008, 21:08
  5. Replies: 1
    Last Post: 20th June 2008, 19:43

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
  •  
Qt is a trademark of The Qt Company.