|
|
|
|
|
- Handling errors
- Position in the file
fRead (Function) In french: fLit Reads a block of bytes in an external file.
Syntax
Reading a block of bytes in an external file Hide the details
<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.
Remarks 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. .
Related Examples:
|
Unit examples (WINDEV): Handling text files
[ + ] Handling "text" files with WINDEV: - Create a text file - Write into a text file - Read in a text file
|
|
Unit examples (WEBDEV): Handling text files
[ + ] This example explains how to handle "non HFSQL" files with WEBDEV and it allows you to: - Create a text file - Write into a text file - Read in a text file
|
|
Unit examples (WINDEV Mobile): Handling text files
[ + ] Handling external "text" files: - Create a text file - Write into a text file - Read in a text file
|
Business / UI classification: Business Logic
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|