AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de archivos externos
  • Example 1: Retrieving attributes from a file
fAttribute (Example)
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
WINDEVWEBDEV - Código ServidorReportes y ConsultasiPhone/iPadIOS WidgetMac CatalystCódigo de Usuario (UMC)Ajax
Example 2: Modifying the attributes of a file
The following code is used to modify the attributes of a file. If this file is not "read-only" (letter R), the file automatically becomes read-only ("read-only" attribute, letter R).
// Declare the variables
ResAttribute is string
ResAttributeModif is string
FilePath is string
// Attributes of the selected file?
ResAttribute = fAttribute(FilePath)
IF ResAttribute <> "ERR" THEN
// The selected file is already read-only?
IF Position(ResAttribute, "R") <> 0 THEN
Info("The file is already read-only")
ELSE
ResAttribute = ResAttribute + "R"
// Modify the attributes of the file
ResAttributeModif = fAttribute(FilePath, ResAttribute)
IF ResAttributeModif <> "ERR" THEN
Info("The file is currently read-only")
END
END
END
IF ResAttribute = "ERR" OR ResAttributeModif = "ERR" THEN
// Display the error message
Error(ErrorInfo(errMessage))
END
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 24/08/2022

Señalar un error o enviar una sugerencia | Ayuda local