buffer_fill

语法:

buffer_fill(buffer, offset, type, value, size);


参数 描述
buffer The index of the buffer to fill.
偏移 The data offset value (in bytes).
type The type of data that is to be written to the buffer (see the list of constants here).
要写入的数据。
大小 The size of the buffer (in bytes) that you wish to fill.


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


描述

This function can be used to fill a previously created buffer with a given data type and value. The data you fill the buffer with must be in agreement with the "type" argument of this function, meaning that you can't try to fill with a string and use the unsigned 16bit integer type, for example. The type constants are the same as those used by the buffer_read and buffer_write functions. The "size" is the size of the buffer (in bytes) that you wish to fill, while the offset is the offset value (also in bytes) from the start of the buffer to start the fill from.


例如:

map_buffer = buffer_create(16384, buffer_fixed, 0);
buffer_fill(map_buffer, 0, buffer_u16, 0, 16384);

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.