.. highlightlang:: us .. index:: mem_set .. _mem_set: mem_set ======= .. us.tag mem_set ENGLISH mem New420 Changed500 Changed5404 :ref:`mem_set` sets the bytes in a string to values of a specified data type. .. function:: bool = mem_set(ssString, pos, values, ssType) .. us.return **Return Value** *bool* is TRUE (1), if the function was executed successfully and otherwise FALSE (1). .. us.params **Parameters** .. uparam:: ssString *ssString* is a string with sufficient space to contain ``len(values)`` of *ssType* data type. .. uparam:: pos *pos* is the position in the string (>= 1). .. uparam:: values *values* are the values which are written to the string. .. uparam:: ssType *ssType* is the data type. List of data types: .. list-table:: :header-rows: 1 * - 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). .. us.example **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); .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Description * - R2012.4 - "int8" and "uint8". * - 5.0.0 - New type "wchar_t". * - 4.2.0 - New. .. seealso:: :ref:`overview-strings`, :ref:`mem_alloc`, :ref:`mem_get`, :ref:`mem_len` :sub:`id-627506`