buffer_seek

语法:

buffer_seek(buffer, base, offset);


参数 描述
buffer The index of the buffer to use.
base The base position to seek.
偏移 The data offset value.


返回: N/A(无返回值)


描述

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:

常量 描述
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


例如:

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.