PDA

View Full Version : QFile Permissions



A9am
26th March 2013, 05:32
Hi ,

I am creating a QFile in my Qt program . I am using this file to read and write some text . I want to give permission for this file so that it cannot be edited (readonly) outside program . Can anyone tell me how can I do this?

Thanks

lanz
26th March 2013, 06:10
Have you tried http://qt-project.org/doc/qt-4.8/qfile.html#setPermissions ?

Lesiok
26th March 2013, 06:29
Permissions are for users not for aplications.

A9am
26th March 2013, 07:00
Actually the file should not be edited by anyone else. Through program I should be able to write and read to and from the file.
Is there any method to do this?

lanz
26th March 2013, 07:28
As Lesiok said, permissions is for users. So if you have a superuser/administrator on the machine it can do anything he likes.
The one way you can go about it is run your application under different user, and save your file in places that hidden from another users (althought superuser can modify your file nevertheless)

Another way is to encrypt your file.