Write Byte to Buffer Method

The Write Byte to Buffer method writes a byte to a buffer at a position that you specify.

Format

bufferVar[offset]

The following table describes the arguments for the Write Byte to Buffer method.

Argument Description

offset

A number that describes a position in the buffer that the bufferVar method identifies. This method does one of the following:

  • Places a byte at the offset position.

  • Reads data from the offset position.

Note the following:

  • If the value that the offset argument contains is less than 0, then this method uses 0.

  • If the value that the offset argument contains is greater than the length of the buffer, then this method uses null bytes to increase the size of the buffer.

Usage

The Write Byte to Buffer method is an array-like version of the Get Cursor Position Value From Buffer method and the Put Value in Buffer method except that the Write Byte to Buffer method works only with bytes. You can write code that gets or sets these values. For example, the following code sets the goo variable to the value of a byte. This byte resides in the buffer at offset position 5:

goo = foo[5]

The following code sets the value of position 5 in the foo buffer to the value that the goo variable contains:

foo[5] = goo

This code assumes the value that the goo variable contains is a single byte value.

Every get or put operation uses eight-bit signed words (SWORD8). If you must work with character values, then you must convert these values to their ANSI equivalent or Unicode equivalent.

Related Topics

For more information, see the following topics: