Moves the current position of the file to the indicated position.


file_bin_seek(binfile, pos);

Argument Description
binfile The ID of the file to read from.
pos The position in the file to move to.

Returns: N/A.


This function moves the current read position within the file to the indicated position. You supply the file ID value, as returned by the function file_bin_open, and to append a file, move the position to the size of the file before writing.

NOTE: These functions do not work when the target module is HTML5.


file = file_bin_open('myfile.bin', 2);
size = file_bin_size(file);
file_bin_seek(file, size);

This would open a file from the same directory as the game, and assign its index to the variable "file", then get the size of the file and set the next writing position to that size.

Back: Binary Files
Next: file_bin_write_byte
© Copyright YoYo Games Ltd. 2018 All Rights Reserved