ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions
  • Handling errors
  • Current position
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
Gets and sets current position in an external file.
When opening a file, the current position corresponds to:
  • the first file byte,
  • the last file byte if the file is opened in "addition" mode (foAdd constant).
Using the read functions (fRead, fReadLine) and the write functions (fWrite, fWriteLine) modifies the current position.
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)PHPAjax
// Open an external file
FileID is int
ResPosition is int
FileID = fOpen("C:\MyDirectories\File.txt", foReadWrite)
IF FileID <> -1 THEN
...
// Get the current position
ResPosition = fSeek(FileID, 0, fpCurrent)
...
END
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)Ajax
// Open an external file
MyTextFile is DiskFile
ResPosition is int
MyTextFile = fOpen("C:\MyDirectories\File.txt", foReadWrite)
IF NOT ErrorOccurred THEN
...
// Get the current position
ResPosition = fSeek(MyFile, 0, fpCurrent)
...
END
Syntax
<Result> = fSeek(<File used> , <Move> , <Source position>)
<Result>: Integer
  • Current position after modification,
  • -1 if an error occurred. To get more details on the error, use ErrorInfo with the errMessage constant.
PHP This parameter must be a variant.
<File used>: Integer or DiskFile variable
<Move>: Integer
Amount of bytes (characters) to offset in the file. To move backwards from the end of the file (fpEnd constant), this number must be negative.
<Source position>: Constant
Specifies the source position:
fpBeginningThe source position corresponds to the first file byte (position 0).
fpCurrentThe source position corresponds to the current position.
fpEndThe source position corresponds to the last file byte.
Remarks

Handling errors

fSeek throws an error in the following cases:
  • the file is not opened,
  • the file is locked by another computer or by another application.

Current position

To retrieve the current position in the external file, use the following syntax:
CurrentPosition = fSeek(FileID, 0, fpCurrent)
No move is performed in the specified file.
Business / UI classification: Business Logic
Component: wd290std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 12/20/2023

Send a report | Local help