Home > lang > datarep 
 en fr de es it nl pt pt_BR mk sq ca hu cs tr ar fa id vi ko ja ru zh zh_TW eo
Previous  Next  Edit  Rename  Undo  Search  Administration  
Documentation  
Warning! This page is not translated.  See english version 
Binary Data Representation
The READ and WRITE instructions allow to read and write binary representation of Gambas datatypes values.

Datatype Size Representation
Boolean 1 byte 0 for FALSE, 255 for TRUE.
Byte 1 byte The data value in binary.
Short 2 bytes The data value in binary.
Integer 4 bytes The data value in binary.
Long 8 bytes The data value in binary.
Pointer 4 bytes in 32 bits
8 bytes in 64 bits
The pointer value in binary.
Single 4 bytes The data value in binary.
Float 8 bytes The data value in binary.
Date 8 bytes The date and time as two four-bytes integers.
String variable The string length is written first, as a variable-length integer number:
  • One byte is written if the string length is lower or equal than 127 characters.
  • Two bytes are written if the string length is between 128 and 16383 characters.
  • Four bytes are written if the string length is between 16384 and 1073741824 characters.
  • Longer strings cannot be written at the moment.
Then the string contents is written.
NULL 1 byte Null values and null strings are written as a single 0 byte.
Variant Variable When writing a variant value, a byte indicating the value datatype is written before. The value itself is written according to this table.

The endianness of the binary data is the endianness of the stream.

See also

READ, WRITE, ByteOrder