Returns current position in the binary file opened by %OPEN.
No options
Parameter
| scalar | Number of bytes of the current position from the start of the file |
Description
%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.