The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.
POS Method (File)
Gets the current position of the file pointer in an ASCII or binary file.
Position := File.POS
Use this variable to refer to the file.
Property Value/Return Value
This show the current position of the file pointer in bytes.
The following example opens a text file that is named C:\TestFolder\TestFile.txt. The WRITEMODE Method (File) enables the file to be open in write mode. The POS method retrieves the position of the file pointer and stores it in the Position variable. When the file is open, the position of the pointer is 0 because a pointer is not set. The SEEK Method (File) method sets a file pointer at position 5. After the SEEK Method (File) is executed, the POS method returns 5 as the file pointer position. This example assumes that you have created a text file named C:\TestFolder\TestFile.txt. This example requires that you create the following global variables.
TestFile.WRITEMODE(TRUE); TestFile.OPEN('C:\TestFolder\TestFile.txt'); Position := TestFile.POS; MESSAGE('Pointer position before SEEK: %1', Position); Testfile.SEEK(5); Position := Testfile.POS; MESSAGE('Pointer position after SEEK: %1', Position);