mem_set sets the bytes in a string to values of a specified data type.
Return Value
bool is TRUE (1), if the function was executed successfully and otherwise FALSE (1).
Parameters
ssString is a string with sufficient space to contain len(values) of ssType data type.
pos is the position in the string (>= 1).
values are the values which are written to the string.
ssType is the data type. List of data types:
| Type Name | Description |
|---|---|
| “char” | One signed byte (-127 bis 127). |
| “wchar_t” | UTF-16 Unicode character (2 bytes). |
| “uchar” | One unsigned byte (0 bis 255). |
| “int16” | 16-bit integer (2 bytes). |
| “uint16” | 16-bit unsigned integer (2 bytes). |
| “int32” | 32-bit integer (4 bytes). |
| “uint32” | 32-bit unsigned integer (4 bytes). |
| “int64” | 64-bit integer (8 bytes). Because UniScript stores 64-bit integers in double format, only (approx.) 52 bits are valid. |
| “uint64” | 64-bit unsigned integer (8 bytes). Because UniScript stores 64-bit integers in double format, only (approx.) 52 bits are valid. |
| “float” | 32-bit real values (4 bytes). |
| “double” | 64-bit real values (8 bytes). |
Example
// Create string with 40 Bytes.
v = mem_alloc(40);
// Write 10 integer values into the buffer (1 .. 10).
mem_set(v, 1, 1:10, "int32");
// Read the 10 values
res = mem_get(v, 1, "int32", 10);
History
| Version | Description |
|---|---|
| 5.0.0 | New type “wchar_t”. |
| 4.2.0 | New. |
See also
id-627506