PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • The unlock operation was not performed
  • Unlocking a file
  • Position in the file
  • Operating mode in Windows Vista (and later)
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
fUnlock (Function)
In French: fDébloque
Entirely or partially unlocks an external file. The file was locked by fLock.
Caution: The unlock operation can be performed only if the section to unlock corresponds to the section locked.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
// Open an external file
FileID = fOpen("C:\MyDirectories\File.txt", foReadWrite)
IF FileID <> -1 THEN
// Lock the file
ResLock = fLock(FileID)
...
// Unlock the external file
ResUnlock = fUnlock(FileID)
END
Syntax
<Result> = fUnlock(<File Identifier> [, <First Byte to Unlock> [, <Number of Bytes to Unlock>]])
<Result>: Boolean
  • True if the unlock operation was performed,
  • False otherwise.
<File Identifier>: Integer
Identifier of the file to unlock, defined by fOpen or fCreate.
<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

fUnlock 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 locked file (or partially locked file) is automatically unlocked when it is closed.
Linux The lock is effective between two different sites or contexts. Unlike Windows, a process cannot lock a file that was previouly locked.

Position in the file

When opening a file, the current position corresponds to:
  • the first byte of the file (by default),
  • the last byte of the file if the file is opened in "addition" mode (foAdd constant).
This position can be modified by fSeek.
The current position is not modified by the execution of fUnlock.
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)

Operating mode in Windows Vista (and later)

If this function does not operate properly in Windows Vista (and later), check whether the file used is not found in one of the system directories (Windows directory or "Program Files" directory).
Indeed, in Windows Vista (and later), with the UAC mechanism (User Account Control) enabled, you must have the administrator privileges to handle and/or modify the files found in the system directories (Windows directory or "Program Files" directory).
Programming tip: To handle and/or modify the files without having administrator privileges, you should:
  • avoid writing into the Windows directory or into the "Program Files" directory,
  • use the system directory corresponding to the application (returned by SysDir associated with the srCommonAppData constant).
Components
WINDEVWEBDEV - Server codeReports and Queries wd230std.dll
Linux wd230std.so
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment