如何保护所选文件 [英] how can protect of selected file

查看:94
本文介绍了如何保护所选文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好
我编写了一个使用文件的程序,但由于另一个程序或用户无法更改或删除此文件,我想限制对该文件的访问.

感谢

hello
I have writen a program that use a file and I want to limit access to this file as another program or user can not change or delete this file.

Thank

推荐答案

如果只想在运行时保护文件,则可以打开文件并对其具有独占访问权限(默认情况下).您可以在运行时结束时关闭流.

—SA
If you want to protect your file just during your run-time, you can simply keep it open with exclusive access to it (which is by default). You can close your stream at the very end of run-time.

—SA


这些链接可能有用:

http://msdn.microsoft.com/en-us/library/3ak841sy%28v = vs.80%29.aspx [ ^ ]

http://msdn.microsoft.com/en-us/library/system. io.isolatedstorage.isolatedstoragefile.aspx [ ^ ]
These links may be useful:

http://msdn.microsoft.com/en-us/library/3ak841sy%28v=vs.80%29.aspx[^]

http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.isolatedstoragefile.aspx[^]


基本上,您不能.
您可以将其隐藏,并使其只读,甚至可以是系统(如果您具有权限),但可以执行任何操作,其他人也可以执行.如果他们无法,则您也无法更改或删除它.

更好的解决方案:对文件内容进行加密,使其不能被修改,只有在您必须的情况下,并希望它能只读.
Basically, you can''t.
You can hide it, and make it read only, and even system (if you have the permissions) but anything you can do, someone else can do too. If they couldn''t, you couldn''t change or delete it either.

Better solution: encrypt the file content so it can''t be modified, make it read only if you must, and hope.


这篇关于如何保护所选文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆