- Example 1: Retrieving attributes from a file
Example 1: Retrieving attributes from a file The following code is used to find out the attributes of a file.
// Declare and initialize the variables ResAttribute is string FilePath is string FileAtt is string = "The file is:" // Attributes of the file? ResAttribute = fAttribute(FilePath) IF ResAttribute <> "ERR" THEN IF Position(ResAttribute, "A") THEN FileAtt = FileAtt + CR + ... TAB + "- an archive file" IF Position(ResAttribute, "C") THEN FileAtt = FileAtt + CR + ... TAB + "- a compressed file" IF Position(ResAttribute, "D") THEN FileAtt = FileAtt + CR + ... TAB + "- a directory" IF Position(ResAttribute, "H") THEN FileAtt = FileAtt + CR + ... TAB + "- a hidden file" IF Position(ResAttribute, "R") THEN FileAtt = FileAtt + CR + ... TAB + "- a read-only file" IF Position(ResAttribute, "S") THEN FileAtt = FileAtt + CR + ... TAB + "- a system file" // Display the attributes of the file Info(FileAtt) ELSE // Display the error message Error(ErrorInfo(errMessage)) END
This page is also available for…
|
|
|
|