You are currently viewing the GMLscripts.com static mirror. Forum access and script submissions are not available through this mirror.

Invert GMLscripts.com

file_bin_seek_relative

Sets the file seek pointer of an open binary file to a position relative to its current position.

//  test.dat contents: 07 5B CD 15 3A DE 68 B1
fid = file_bin_open("test.dat", 0);
b1 = file_bin_read_byte(fid);  //  b1 == 0x07
file_bin_seek_relative(fid, 5);
b2 = file_bin_read_byte(fid);  //  b2 == 0x68
file_bin_seek_relative(fid, -4);
b3 = file_bin_read_byte(fid);  //  b3 == 0x15
file_bin_close(fid);
file_bin_seek_relative(file,pos)
Sets the file seek pointer of an open binary file to a position relative to its current position.
COPY/// file_bin_seek_relative(file,pos)
//
//  Sets the file seek pointer of an open binary file
//  to a position relative to its current position.
//
//      file        file id of an open binary file, real
//      pos         relative position to seek, real
//
/// GMLscripts.com/license
{
    var file,offset;
    file = argument0;
    offset = argument1;
    file_bin_seek(file,file_bin_position(file)+offset);
    return 0;
}

Contributors: Leif902

GitHub: View · Commits · Blame · Raw