ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / External file functions
  • Handling errors
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Returns the size of a file (in bytes).
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)PHPAjax
// Taille d'un fichier
ResTaille is int
ResTaille = fSize("C:\MesRépertoires\Fichier.doc")
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)PHPAjax
// Ouverture d'un fichier externe
MonFichierTxt is DiskFile
ResTaille is int
MonFichierTxt = fOpen("C:\MesRépertoires\Fichier.txt", foReadWrite)

// Taille d'un fichier
ResTaille = fSize(MonFichierTxt)
Syntax
WINDEVWEBDEV - Server codeReports and QueriesAndroidAndroid Widget iPhone/iPadIOS WidgetMac CatalystJavaUser code (UMC)PHPAjax

Getting the size of a file according to its path Hide the details

<Result> = fSize(<File path>)
<Result>: Integer
  • File size in bytes,
  • -1 if an error occurred. To get more details on the error, use ErrorInfo with the errMessage constant.
When handling files exceeding 2 GB, <Result> must correspond to an 8-byte integer.
<File path>: Character string
Name and full or relative path of the file (up to 260 characters). A UNC path can be used. Wildcard characters (* and?) are not allowed.
WindowsLinux This parameter can be in Ansi or Unicode format.
AndroidAndroid Widget This parameter can correspond to a full path or a path relative to the current directory (returned by fCurrentDir). This parameter is case-sensitive.
Reminder: In Android, the file system is read-only on the device and on the emulator. An application can only write to its installation directory or one of its subdirectories, as well as to the external memory (SDCard).
iPhone/iPadIOS WidgetMac Catalyst This parameter can correspond to a full path or a path relative to the current directory (returned by fCurrentDir). This parameter is case-sensitive.
Reminder: On iPhone/iPad, both on the device and in the emulator, the file system is read-only.. An application can only write to its installation directory or one of its subdirectories.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadIOS WidgetMac CatalystUser code (UMC)Ajax

Finding out the size of a file opened by the application Hide the details

<Result> = fSize(<File used>)
<Result>: Integer
  • File size in bytes,
  • -1 if an error occurred. To get more details on the error, use ErrorInfo with the errMessage constant.
When handling files exceeding 2 GB, <Result> must correspond to an 8-byte integer.
<File used>: Integer or DiskFile variable
Remarks

Handling errors

fSize throws an error in the following cases:
  • the specified file does not exist,
  • the name of the specified file is invalid.
Note: fSize does not work on hidden files.
Business / UI classification: Business Logic
Component: wd300std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Video fSize
https://youtu.be/HyN7Hq54yIw

https://windevdesenvolvimento.blogspot.com/2019/06/dicas-2171-windev-webdev-mobile-arquivo.html

// BTN_TAMANHO_ARQUIVO

n_tamanho_arquivo is int=fSize(EDT_ARQUIVO)
EDT_RESPOSTA=LengthToString(n_tamanho_arquivo,sizeB)+CR
EDT_RESPOSTA+=LengthToString(n_tamanho_arquivo,sizeGB)+CR
EDT_RESPOSTA+=LengthToString(n_tamanho_arquivo,sizeKB)+CR
EDT_RESPOSTA+=LengthToString(n_tamanho_arquivo,sizeMB)+CR
EDT_RESPOSTA+=LengthToString(n_tamanho_arquivo,sizeTB)+CR
amarildo
28 Jun. 2019

Last update: 09/24/2024

Send a report | Local help