buffer_seek

Syntax:

buffer_seek(buffer, base, offset);


Argument Description
buffer The index of the buffer to use.
base The base position to seek.
offset The data offset value.


Returns: N/A


Description

This function can be used to move through a buffer, finding the start, the end, or a position relative to that which was last used when reading or writing data. The "offset" value is the offset (in bytes) to add to the given seek position, for example, if the base is relative and the offset is 4, then the buffer position will move along 4 bytes from its current position. Please note the following:

The following constants are accepted as the "base" argument for seeking to:

Constant Description
buffer_seek_start The start of the buffer
buffer_seek_relative A position relative to the current read/write position
buffer_seek_end The end of the buffer


Example:

buffer_seek(buff, buffer_seek_start, 0);
buffer_write(buff, buffer_s16, 0);
buffer_write(buff, buffer_s16, x);
buffer_write(buff, buffer_s16, y);

The above code finds the start of the buffer with the id stored in the variable "buff" them writes a series of signed 16bit integer values to it.