ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions
  • The unlock operation was not performed
  • Unlocking a file
  • Position in the file
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
<DiskFile variable>.Unlock (Function)
In french: <Variable FichierDisque>.Débloque
Entirely or partially unlocks an external file. The file was locked by <DiskFile variable>.Lock.
Caution: The unlock operation can be performed only if the section to unlock corresponds to the section locked.
Example
// Ouverture d'un fichier externe
MonFichierTxt is DiskFile
ResDébloque is boolean
IF MonFichierTxt.Ouvre("C:\MesRépertoires\Fichier.txt", foReadWrite) = True THEN
// Blocage du fichier
ResBloque = MonFichierTxt.Bloque()
...
// Déblocage du fichier externe
ResDébloque = MonFichierTxt.Débloque()
END
Syntax
<Result> = <File used>.Unlock([<First byte to unlock> [, <Number of bytes to unlock>]])
<Result>: Boolean
  • True if the unlock operation was performed,
  • False otherwise.
<File used>: DiskFile variable
Name of the DiskFile variable initialized with .Open or Create.
<First byte to unlock>: Optional integer
Position of the first byte (character) to unlock (0 corresponds to the first byte of the file).
<Number of bytes to unlock>: Optional integer
Number of bytes (characters) to unlock.
Remarks

The unlock operation was not performed

<DiskFile variable>.Unlock returns False if the unlock operation was not performed. The unlock operation can be performed if:
  • the external file is opened.
  • the file identifier is valid.
  • the file or the bytes to unlock are identical to the locked ones. For example, if only a file section was locked, this same section must be unlocked. If the file was entirely locked, you cannot unlock a section of the file.
  • the file or the bytes to unlock have been locked by the same application and from the same computer.

Unlocking a file

  • The file is entirely unlocked if <First byte to unlock> and <Number of bytes to unlock> are not specified.
  • The file is unlocked from the first specified byte (<First byte to unlock>) to the end of file if <Number of bytes to unlock> is not specified.
  • A blocked (or partially blocked) file will be automatically unblocked when it is closed.

Position in the file

When opening a file, the current position corresponds to:
  • the first file byte (by default),
  • the last byte of the file if the file is opened in "addition" mode (foAdd constant).
This position can be modified by <DiskFile variable>.Seek.
The current position does not change when <DiskFile variable>.Unlock is executed.
Business / UI classification: Business Logic
Component: wd290std.dll
Minimum version required
  • Version 28
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 11/17/2023

Send a report | Local help