PutByte


The PutByte method writes byte (8 bit) sequence to file and returns number of elements actually written. File position is moved forward by the number of bytes written.
C++
long PutByte(
  BYTE *ByteBuffer,                // buffer that contains data
  long NumberOfElements,           // number of elements to write
  long FilePosition = -1           // position of data in file
);
BASIC
PutByte(
  ByteBuffer As Variant,           // variant that contains data
  NumberOfElements As Long = -1,   // number of elements to write
  FilePosition As Long = -1        // position of data in file
) As Long

Parameters

ByteBuffer
C++
Pointer to buffer that contains data.
BASIC
Variant that contains data.
Variant type must be compatible with Byte data type; it can be either single variable or one-dimensional array.
NumberOfElements
Number of elements in data sequence to write.
BASIC
If this parameter is -1 length of sequence is determined by the size of ByteBuffer.
FilePosition
Position in file to write data at.
If this parameter is -1 data is written at current file position.

Return Values

If the method succeeds, the return value is the number of elements actually written.
If the method fails, the return value is failure code and error code is set. Call GetError to get error code.

Remarks

BASIC
ByteBuffer can be either single variable of type Byte or one-dimensional Byte array, depending on how many elements are to be written. If only one element is written, ByteBuffer can be a single variable, if more than one element is to be written it must be a one-dimensional array.

See Also

GetByte, PutBit, PutShort, PutLong, PutFloat, PutDouble, PutText, PutUnicodeText, PutVariant, PutBinary, Reading and Writing Data