mem_set

mem_set sets the bytes in a string to values of a specified data type.

bool = mem_set(ssString, pos, values, ssType)

Return Value

bool is TRUE (1), if the function was executed successfully and otherwise FALSE (1).

Parameters

ssString

ssString is a string with sufficient space to contain len(values) of ssType data type.

pos

pos is the position in the string (>= 1).

values

values are the values which are written to the string.

ssType

ssType is the data type. List of data types:

Typ

Description

“int8” or “char”

One signed byte (-127 bis 127). values can be a real vector or a string.

“wchar_t”

UTF-16 Unicode character (2 bytes). values can be a real vector or a string.

“uint8” or “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

R2012.4

“int8” and “uint8”.

5.0.0

New type “wchar_t”.

4.2.0

New.

id-627506