File descriptors in the operating system have a file descriptor table maintained by the kernel at the system level. The status information contained in it includes file access modes, and there are three types
read only
write only
read&write
What is the situation of write only? What I can imagine is writing with the ">>" character in terminal mode, but I don't know how to use it in the gui interface, such as various text editors. How to implement this write only without viewing the file content
Don’t be confused by the gui. Taking the editor as an example, it naturally has to be read out to the user before the user can write.
But many times, you can write without reading the file content. For example, the log keeps appending content to the end of the file, and the previous content is not read.
How to do it? Of course, the operating system (the file system) does this permission restriction, and the application layer program only applies for these permissions. For example, the editor must have read permission. Without write permission, you cannot edit, or at least you must be able to read.