Site Tools
Sidebar
User's Manual
t2:pmem_write
pmem_write
pmem_write — Write persistent memory
Description
void pmem_write(uint8 offset, <anytype> value);
Write on position offset, of the persistent memory RAM array, the value of type and size defined by <anytype>.
Parameters
- offset: Position of the persistent memory array, starting from 0, to which the value should be write.
- <anytype> value: A value of type <anytype>.
<anytype> can be: int8 , uint8 , int16 , uint16 , int32 , uint32 , fix32 or any of its aliases. |
Byte Size of Variable Types | ||
---|---|---|
int8 , uint8 | 1 byte | |
int16 , uint16 | 2 bytes | big-endian |
int32 , uint32 , fix32 | 4 bytes | big-endian |
Return Value
No value is returned.
Persistent Memory
The persistent memory is an array of 128 bytes that can be used to store data structures such that they can continue to be accessed even after the end of the GPC script that created or last modified them.
For performance reasons the operations pmem_read()
and pmem_write()
are performed in RAM, therefore the persistent memory contents should first be loaded into RAM space by pmem_load()
and, if modified, saved with pmem_save()
.
Examples
Example #1 pmem_write() example
void set_pvar(uint8 idx, int16 val) { pmem_write(idx, val); pmem_save(); }
See Also
t2/pmem_write.txt · Last modified: 2016/12/02 06:26 by J2Kbr