How to enforce READ_ONCE_ONLY built-in control for a file?
How to control access to a file in hard drive so that it can be rea开发者_Python百科d once only. After the first access, the file should be rendered inaccessible.
I don't think this is implemented by the operating systems usually. However, it can be done programmically.
Suppose user A is trying to read the file F. We want the reading of F to be restricted to once only. The owner of the file F is user B. The file F is provided a read access to a program (for example by keeping the owner of the program B, and allowing read access to the owner only). The program can be used to read the content of the file and print it on the console. When the program runs, it also creates a file F2 in the hard disk. It always checks that if this file F2 is present, it disallows reading the file F.
精彩评论