Gambas Documentation - /lang/memory

/lang/memory

# MEMORY

Stream = MEMORY Pointer [ FOR [ READ ] [ WRITE ] ]

Create a stream that allows to directly read binary data from memory, or write binary data to memory.

- If the `READ` keyword is specified, then reading is allowed. This keyword is optional, as reading is actually always allowed.

- If the `WRITE` keyword is specified, then writing is allowed.

The first read or write is done at the memory address specified by Pointer, but beware that reading or writing to the stream makes the stream internal pointer go forward.

The stream position set by SEEK or returned by Seek is the number of bytes from Pointer.

If you try to write to a forbidden memory address, you will get an error. The interpreter won't crash.

IMPORTANT!

Reading or writing a string on a memory stream with the READ or WRITE instructions does not use the Gambas Binary Data Representation.

Instead, null-terminated strings are read or written.

### See also

- READ

- WRITE

- Binary Data Representation

- Stream & Input/Output functions

- Stream