AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de archivos externos
  • The unlock operation was not performed
  • Unlocking a file
  • Position in the file
  • Operating mode in Windows Vista (and later)
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Entirely or partially unlocks an external file. The file was locked by fLock.
Attention Unlocking can only be performed if the part to be unlocked corresponds to the blocked part.
// Open an external file
FileID is int
ResUnlock is boolean
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
// Open an external file
MyTextFile is DiskFile
ResUnlock is boolean
MyTextFile = fOpen("C:\MyDirectories\File.txt", foReadWrite)
IF NOT ErrorOccurred THEN
	// Lock the file
	ResLock = fLock(MyTextFile)
	...
	// Unlock the external file
	ResUnlock = fUnlock(MyTextFile)
END
Sintaxis
<Result> = fUnlock(<File used> [, <First byte to unlock> [, <Number of bytes to unlock>]])
<Result>: Boolean
  • True if the unlock operation was performed,
  • False otherwise.
<File used>: Integer or DiskFile variable
<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.
Observaciones

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 blocked (or partially blocked) file will be automatically unblocked when it is closed.
Linux Special case:
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 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 fSeek.
The current position does not change when fUnlock is executed.
WINDEVCódigo de Usuario (UMC)

Operating mode in Windows Vista (and later)

If this function does not work properly in Windows Vista (and later), check whether the file or directory used is not in one of the system directories (Windows directory or "Program Files" directory).
In Windows Vista (and later), with the UAC mechanism (User Account Control) enabled, you must have administrator privileges to handle and/or modify the files or directories in system directories (Windows directory or "Program Files" directory).
Programming tip: If you need to manipulate / modify files or directories, without needing administrator privileges, it is advisable:
  • avoid writing to the Windows directory or to the "Program Files" directory,
  • use the system directory of the application (returned by SysDir with the srAppDataCommun constant, for example).
Clasificación Lógica de negocio / UI: Lógica de negocio
Componente: wd300std.dll
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/03/2025

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