RawMemoryImport
✖
RawMemoryImport
represents an operator form of RawMemoryImport that can be applied to an expression.
Details and Options

- Supported values of ptr include RawPointer expressions and ManagedObject expressions whose values are pointers.
- Supported values of format include:
-
"String" null-terminated string {"String",len} string of len bytes {"ByteArray",len} byte array of len bytes {"NumericArray",len} numeric array of len elements {"List",len} list of len elements - For "NumericArray" and "List" import formats, the element type is determined by the type of the input pointer ptr.
- Supported options include:
-
CharacterEncoding "UTF-8" character encoding for strings
Examples
open allclose allBasic Examples (1)Summary of the most common use cases
Scope (4)Survey of the scope of standard use cases
RawMemoryImport supports passing a managed pointer as its first argument:

https://wolfram.com/xid/0dqwiufp1iq-mwb9iq


https://wolfram.com/xid/0dqwiufp1iq-9mwcxd

It also supports passing a non-managed pointer:

https://wolfram.com/xid/0dqwiufp1iq-w8odst


https://wolfram.com/xid/0dqwiufp1iq-8op9ak

Export a string as raw memory:

https://wolfram.com/xid/0dqwiufp1iq-43l24a

Import the raw memory as a "List":

https://wolfram.com/xid/0dqwiufp1iq-gtpw22

Import the raw memory as a "ByteArray":

https://wolfram.com/xid/0dqwiufp1iq-s8uimj

Import the raw memory as a "NumericArray":

https://wolfram.com/xid/0dqwiufp1iq-ttwdvv

Export a string as a raw memory:

https://wolfram.com/xid/0dqwiufp1iq-pxtj60
For null-terminated strings, the length does not need to be specified:

https://wolfram.com/xid/0dqwiufp1iq-i4oer0

Use RawMemoryImport in operator form:

https://wolfram.com/xid/0dqwiufp1iq-8n26yu

Options (1)Common values & functionality for each option
CharacterEncoding (1)
Export a string with non-ASCII characters as raw memory:

https://wolfram.com/xid/0dqwiufp1iq-2htoma
Specify what CharacterEncoding should be used when importing a string:

https://wolfram.com/xid/0dqwiufp1iq-ezzlqc


https://wolfram.com/xid/0dqwiufp1iq-zh75gj

Properties & Relations (1)Properties of the function, and connections to other functions
RawMemoryExport is the inverse operation of RawMemoryImport:

https://wolfram.com/xid/0dqwiufp1iq-x10wkb


https://wolfram.com/xid/0dqwiufp1iq-i3r68f

Possible Issues (1)Common pitfalls and unexpected behavior
RawMemoryImport fails if the format is not supported:

https://wolfram.com/xid/0dqwiufp1iq-drjphp


Wolfram Research (2023), RawMemoryImport, Wolfram Language function, https://reference.wolfram.com/language/ref/RawMemoryImport.html.
Text
Wolfram Research (2023), RawMemoryImport, Wolfram Language function, https://reference.wolfram.com/language/ref/RawMemoryImport.html.
Wolfram Research (2023), RawMemoryImport, Wolfram Language function, https://reference.wolfram.com/language/ref/RawMemoryImport.html.
CMS
Wolfram Language. 2023. "RawMemoryImport." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RawMemoryImport.html.
Wolfram Language. 2023. "RawMemoryImport." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RawMemoryImport.html.
APA
Wolfram Language. (2023). RawMemoryImport. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RawMemoryImport.html
Wolfram Language. (2023). RawMemoryImport. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RawMemoryImport.html
BibTeX
@misc{reference.wolfram_2025_rawmemoryimport, author="Wolfram Research", title="{RawMemoryImport}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/RawMemoryImport.html}", note=[Accessed: 29-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_rawmemoryimport, organization={Wolfram Research}, title={RawMemoryImport}, year={2023}, url={https://reference.wolfram.com/language/ref/RawMemoryImport.html}, note=[Accessed: 29-March-2025
]}