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
  • Handling errors
  • Position in the file
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
Reads a block of bytes in an external file.
AndroidWidget Android JavaPHP In this version, you can only read a character string from an external file in ANSI format.
WINDEVWEBDEV - Código ServidorReportes y ConsultasJavaCódigo de Usuario (UMC)PHPAjax
// Open an external file
FileID is int
ResRead is int
FileID = fOpen("C:\MyDirectories\File.txt", foReadWrite)
IF FileID <> -1 THEN
	// Read operation in this file
	ResRead = fRead(FileID, 200)
	...
END
WINDEVWEBDEV - Código ServidorReportes y ConsultasJavaCódigo de Usuario (UMC)PHPAjax
// Open an external file
MyTextFile is DiskFile
ResRead is int
MyTextFile = fOpen("C:\MyDirectories\File.txt", foReadWrite)
IF NOT ErrorOccurred THEN
	// Read operation in this file
	ResRead = fRead(MyTextFile, 200)
	...
END
Sintaxis

Reading a block of bytes in an external file Ocultar los detalles

<Result> = fRead(<File used> , <Number of bytes to read>)
<Result>: Character string
  • Block of bytes that was read.
  • Empty string ("") if an error occurred. To get more details on the error, use ErrorInfo with the errMessage constant.
<File used>: Integer or DiskFile variable
<Number of bytes to read>: Integer
Number of bytes to read (up to 2 147 483 648 bytes).
If the data is a Unicode string, the number of bytes to read corresponds to:
  • in UTF16: the number of characters multiplied by 2.
  • in UTF32: the number of characters multiplied by 4.
WINDEVWEBDEV - Código ServidorReportes y ConsultasiPhone/iPadIOS WidgetMac CatalystCódigo de Usuario (UMC)Ajax

Reading the content of an external file and assigning it to a memory area (identified by its address) Ocultar los detalles

<Result> = fRead(<File used> , <Number of bytes to read> , <Address>)
<Result>: Integer
  • Number of bytes read,
  • 0 if an error occurs. To get more details on the error, use ErrorInfo with the errMessage constant.
<File used>: Integer or DiskFile variable
<Number of bytes to read>: Integer
Number of bytes to read (up to 2 147 483 648 bytes).
If the data is a Unicode string, the number of bytes to read corresponds to:
  • in UTF16: the number of characters multiplied by 2.
  • in UTF32: the number of characters multiplied by 4.
<Address>: Address
Address of affected memory section.
Observaciones

Handling errors

fRead throws an error in the following cases:
  • the file is not opened,
  • the file is not accessible in read mode,
  • the file is locked by another computer or by another application,
  • the end of the file has been reached.

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 is the file is opened in "addition" mode (foAdd constant).
This position can be modified by fSeek.
fRead reads the specified elements from the current position. Once fRead has been executed, the current position is set to the last byte read.
Note: To always read the beginning of the file, use the fSeek function followed by the fReadfunction. .
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: 28/03/2025

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