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
<DiskFile variable>.Seek (Function)
In french: <Variable FichierDisque>.Positionne
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 (<DiskFile variable>.Read, <DiskFile variable>.ReadLine) and the write functions (<DiskFile variable>.Write, <DiskFile variable>.WriteLine) modifies the current position.
Example
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)Ajax
// Open an external file
MyTextFile is DiskFile
ResPosition is int
IF MyTextFile.Open("C:\MyDirectories\File.txt", foReadWrite) THEN
...
// Get the current position
ResPosition = MyTextFile.Seek(0, fpCurrent)
...
END
Syntax
<Result> = <File used>.SetPosition(<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.
<File used>: DiskFile variable
Name of the DiskFile variable initialized with .Open or Create.
<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

<DiskFile variable>.Seek 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:
NomFichier is DiskFile
...
PositionEnCours = NomFichier.Positionne(0, fpCurrent)
No move is performed in the specified file.
Business / UI classification: Business Logic
Component: wd290std.dll
Minimum version required
  • Version 28
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 11/21/2023

Send a report | Local help