.. highlightlang:: us .. _mem_alloc: mem_alloc ========= .. index:: mem_alloc .. us.tag mem_alloc ENGLISH mem New420 Changed500 :ref:`mem_alloc` creates a scalar string of the given length. .. function:: ssString = mem_alloc(n) ssString = mem_alloc(n, c) .. us.return **Return Value** *ssString* is string with n bytes. .. us.params **Parameters** .. uparam:: n *n* is the number of bytes of the string. .. uparam:: c *c* is a string or number which is used to initialize the string. If *c* is a string only the first character is used. If *c* is a number, the number is converted to a 8-bit value. .. us.example **Example** :: def GetCurrentDirectory() { ret = RegisterFunction("KERNEL32", "GetCurrentDirectoryA",.. "uint", "_GetCurDir", ["uint", "char*"]); ssBuffer = mem_alloc(1024); _GetCurDir(1024, ssBuffer) return strtrim(ssBuffer); } .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Description * - 5.0.0 - ??? * - 4.2.0 - New. .. seealso:: :ref:`overview-strings`, :ref:`mem_len`, :ref:`strlen`, :ref:`mem_set`, :ref:`mem_get` :sub:`id-783686`