Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






Attributes of the file. Temporary characteristics. File length.

Working with files - the most important generator of almost any program. With the advent of high-speed drive large volumes of files value has risen dramatically. Using the API-file manager can make our program more efficient and productive.

File Attributes

Size - DWORD.

FILE_ATTRIBUTE_READONLY equ 1h

Attribute "read only." Applications can only read the file. Accordingly, an attempt to open a file for writing an error.

FILE_ATTRIBUTE_HIDDEN equ 2h

The attribute "hidden file". "Invisible" normal view catalog.

FILE_ATTRIBUTE_SYSTEM equ 4h

Attribute "file system." Indicates that the file belongs to the operating system.

FILE_ATTRIBUTE_DIRECTORY equ 10h

Attribute "directory". With files with this attribute operating system accesses a particular way, including its catalog, ie considering it a list of files consisting of records of 32 bytes.

FILE_ATTRIBUTE_ARCHIVE equ 20h

Since the days of MS-DOS files were observed in this attribute over which the operation is not performed BACKUP or XCOPY. For programming this attribute is equivalent to the zero value of the attribute.

FILE_ATTRIBUTE_NORMAL equ 80h

This attribute indicates that the file has not set any other attributes.

FILE_ATTRIBUTE_TEMPORARY equ 100h

Attribute indicates that the file is intended for temporary data storage. After closing the file system should remove it.

FILE_ATTRIBUTE_COMPRESSED equ 800h

For a file it means that it is a compression system, the directory - the newly generated default file should be compressed.

FILE_ATTRIBUTE_OFFLINE equ 1000h

Attribute indicates that the file data is not currently available.

The change of the attribute can be made a function of SetFileAttributes, get the value of the attribute function GetFileAttributes. It should be noted that if the operating system does not impose any restrictions on the possibility of changing file attributes, the attributes of impaired sense of themselves - you can always remove the attribute "read only" and be done with the file it wants.

Time characteristics

The file has three time characteristics:

creation time,

time of last modification,

last access time.

Time is measured in nanosecond intervals since 12:00 pm January 1, 1600 and is stored in two 32-bit values. I must say that it is kept in the so-called universal coordinates and must still be converted to the local time (function FileTimeToLocalFileTime). Get the value of all three periods can function GetFileTime.

Length of file

File length in bytes typically stored in two 32-bit values ​​or one 64-bit value. If a 32-bit value denoted as 11 (low part) and 12 (the highest part), the 64-bit value will be expressed by the formula 12 * 0FFFFH + 11. Size can be a function GetFileSize.

Name

In addition to these characteristics, the file, of course, has a name. In this case, we distinguish between long and short name. Similarly, we distinguish between full path (with all the long names) and a shorter path (all names have been replaced long truncated). The need to use the shortened name and path is dictated primarily by the fact that some programs receive path or the name of the standard input and treat spaces as delimiters for the parameters. Convert long name can be accomplished in a short feature GetShortPathName, who works for a name, and path. The inverse transformation is a function of GetFullPathName.



 

 


Date: 2015-01-29; view: 1078


<== previous page | next page ==>
Global declarations. | File FAT32 system. Catalogue structure. FAT table.
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.006 sec.)