PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Managing errors
  • Position in the file
  • Managing the ANSI/UNICODE format
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
Reads a line in an external file.
PHP In this version, you only have the ability to read a line in an external file in ANSI format.
Versions 15 and later
Android This function is now available for Android applications.
New in version 15
Android This function is now available for Android applications.
Android This function is now available for Android applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android widget mode.
New in version 18
Android Widget This function is now available in Android widget mode.
Android Widget This function is now available in Android widget 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.
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)PHPAjax
// Ouverture d'un fichier externe
IDFichier = fOpen("C:\MesRépertoires\Fichier.txt", foReadWrite)
IF IDFichier <> -1 THEN
// Lecture d'une ligne dans ce fichier
ResLecture = fReadLine(IDFichier)
...
END
Syntax
<Result> = fReadLine(<File identifier> [, <Separator>])
<Result>: Character string or UNICODE character string
  • Line read in an external file.
  • EOT constant if the end of file has been reached.
  • Empty string ("") if an error occurred. In this case, the ErrorOccurred variable is set to True.
Remark: A line ends with a CR character (Carriage Return).
PHP This parameter must be a character string.
<File identifier>: Integer
Identifier of the file to use, defined by fOpen or fCreate.
PHP This parameter must be a variant.
<Separator>: Character string
Versions 17 and later
Separator used between the lines. The default separator is the Carriage Return (CR).
AndroidAndroid Widget JavaPHP This parameter is not available. The separator used is the Carriage return (CR).
New in version 17
Separator used between the lines. The default separator is the Carriage Return (CR).
AndroidAndroid Widget JavaPHP This parameter is not available. The separator used is the Carriage return (CR).
Separator used between the lines. The default separator is the Carriage Return (CR).
AndroidAndroid Widget JavaPHP This parameter is not available. The separator used is the Carriage return (CR).
Remarks

Managing errors

fReadLine 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. fUnlock is used to unlock an external file.

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 is the file is opened in "addition" mode (foAdd constant).
This position can be modified by fSeek.
The fReadLine function reads the specified items from the current position. After fReadLineis executed, the current position is the last byte read. The fReadLine function returns the constant EOT if the end of the file has been reached.
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)Ajax

Managing the ANSI/UNICODE format

The fReadLine function allows you to read:
  • a Unicode string into a Unicode file.
  • an Ansi string into an Ansi file.
The file is created or opened with fCreate/fOpen by specifying the file type.
Depending on the format of the external file used, some conversions are required once a character string was read in an external file:
Current computer
External file
in ANSI format
(fOpen or fCreate associated with the foAnsi constant)
External file
in UNICODE format
(fOpen or fCreate associated with the foUnicode constant)
Function fReadLinePC running WindowsRead operation in ANSI format
Conversion to UNICODE possible with AnsiToUnicode
MobileRead operation in UNICODE format
Conversion to ANSI possible with UnicodeToAnsi
Remark: If the result of the fReadLine function in an ANSI file is assigned to a UNICODE string (and vice versa), the conversion will be implicitly performed.
For more details, see Managing UNICODE
Related Examples:
Handling text files 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
Handling text files 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
Handling text files 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
Component: wd270std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment