AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de archivos
  • Example 1: Calculating the size of an archive file according to its subscript
  • Example 2: Calculating the size of an archive file according to its stored path
zipFileSize (Example)
Example 1: Calculating the size of an archive file according to its subscript
WINDEVWEBDEV - Código ServidorReportes y ConsultasCódigo de Usuario (UMC)Ajax The following code is used to calculate the size of an archive file before extracting it. If the user confirms the extraction of the file, the file is extracted.
In this example, we will assume that the archive is already opened and that the file (whose size is requested) is selected in a Table control populated programmatically (TABLE_ArchiveTable).
Caution: In order for the index of the Table control populated programmatically to match the index of the selected file, the Table control must not be sorted.
// --Click code of BTN_ExtractFile
// Declare and initialize the variables
FileIndex is int
FileSize is int
ErrorCodeExtract is int
ArchiveName is string = "MyArchive"
 
// Select the file in the archive
FileIndex = TableSelect(TABLE_ArchiveTable)
 
// Initial size of the file
FileSize = zipFileSize(ArchiveName, FileSubscript)
 
// Extract the selected file
IF YesNo("This file will occupy: " + FileSize, "Do you want to extract this file?") THEN
// Extract the file
ErrorCodeExtract = zipExtractFile(ArchiveName, FileSubscript)
// Display an error message if the file was not extracted
IF ErrorCodeExtract <> 0 THEN
Error(zipMsgError(ErrorCodeExtract))
END
END
Example 2: Calculating the size of an archive file according to its stored path
WINDEVWEBDEV - Código ServidorReportes y ConsultasCódigo de Usuario (UMC)Ajax The following code is used to calculate the size of an archive file before extracting it.
In this example, we will assume that the archive is already opened and that the file (whose size is requested) is selected according to its stored path.
// --Click code of BTN_ExtractFile
 
// Declare and initialize the variables
FileSize is int
ErrorCodeExtract is int
ArchiveName is string = "MyArchive"
 
// Initial size of the file
FileSize = zipFileSize(ArchiveName, "Files\File.txt")
 
// Extract the selected file
IF YesNo("The File.txt file will occupy: " + FileSize, ...
"Do you want to extract this file?") THEN
    // Extract the file
    ErrorCodeExtract = zipExtractFile(ArchiveName, "Files\File.txt")
    // Display an error message if the file was not extracted
    IF ErrorCodeExtract <> 0 THEN
Error(zipMsgError(ErrorCodeExtract))
    END
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: 27/05/2022

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