C program to set file attributes




















It is used to write those data somewhere and save it permanently. Some pointer related structures are used to point towards that sort of file for reference. Different File handling Functions in C are as follows:. There are certain privileges which are needed to be provided to the file while opening or we can say kind of access control. As mentioned earlier certain specific types of pointer structures are needed for file to point these attributes are part of that only.

These attributes are as follows:. Reading from a file involves the usage of both fscanf and fgets. Both functions are almost similar to the fact that both have the same functionality with a difference of using an additional parameter, the file pointer which can be used either to read a file line by line or character by character. Writing in a file can be done using both the functions fprintf and fputs in the same way as read operations. Once all operations are performed successfully and it is always asked to close the file and for closing any file it is very much needed to use fclose function.

File Handling in any programming language not only in C plays a very important role especially in the industry as it will store the data in memory permanently which can be referred later at any point in time. To get file attributes use static method File. The method returns FileAttributes which is a bitwise combination of file attribute flags. To set file attributes use static method File. Parameter of the method is a bitwise combination of FileAttributes enumeration.

Note The fileapi. In this article. A file or directory that is an archive file or directory. Applications typically use this attribute to mark files for backup or removal. The file or directory is hidden. It is not included in an ordinary directory listing. A file that does not have other attributes set.

This attribute is valid only when used alone. The data of a file is not available immediately. This attribute indicates that the file data is physically moved to offline storage. This attribute is used by Remote Storage, which is the hierarchical storage management software.

Applications should not arbitrarily change this attribute. A file that is read-only. Applications can read the file, but cannot write to it or delete it. This attribute is not honored on directories. A file that is being used for temporary storage.



0コメント

  • 1000 / 1000