05-22-2009 07:13 AM
Hi,
I have a small application where some data are being stored to a txt file. What I want to do is the user to be able to open or copy the file with the results but not being able to delete the file from the hard disk.
Is there any way of setting this attribute in my application when the file is initially created?
Thank you.
Achille
05-24-2009 02:22 PM
I would recommend using the 'Set Permissions' fuction under:
Programming >> File I/O >> Advanced File Function.
Input the path for the file of interest.
Then for the input 'Permissions', look at the LabVIEW help for this function.
It takes a 9 bit input to select : full access, read-only, no access.
For Windows, I think all you can modify is bit 7, write-access (which would also not allow you to delete).
If you wire 200 to Permissions, it is the equivalent (in binary) to 10000000.
This will make the file read-only.
05-25-2009 06:34 AM
Dear Cory,
Thank you for your reply. I have tried your suggestion but although the file becomes read-only I am still able to delete it.
I am trying to figure out a way but I haven't find anything yet.
Any other suggestion?
Thank you.
Achille
05-25-2009 07:54 AM
To set a file to read only you need to wire decimal 256 (octal 400, binary 100000000) to the permissions input.
To set the permissions in more details you need some other tools or access the windows API.
Daniel