1. Home


Returns current position in the binary file opened by %OPEN.

No options


scalar Number of bytes of the current position from the start of the file


%FPOSITION has a single unnamed parameter, which saves the current write position in the binary file opened by %OPEN. This can be used to relocate the %WRITE directive to that position in the file. For example, if you wanted to change a value in the file later during its use, you could save the position of that value, and then use %WRITE to write the new value into the file.

For example:

%FPOSITION file_length_position
%WRITE 0 "Write a dummy value to hold the position"
"... more %WRITE commands"
%FPOSITION file_length "Get current position = file length"
%WRITE [POSITION=file_length_position] file_length

Options: none.
Parameter: unnamed.

See also

Directives: %CLOSE, %OPEN, %WRITE.
Commands for: Program control.

Updated on February 7, 2023

Was this article helpful?