Definition: | string s = peek_string(atom addr) |
Description: | Retrieve a string that starts at the supplied memory address. |
Comments: |
Reads characters until a terminating null is found.
In some cases a fixed size is used to hold a string, for example the Names in the Section Table of a PE format file (such as .text, .data) are x8 and may not always have a terminating zero. Either use peek({addr,8}) and trim the result if it contains any null characters, or, slightly less safe, use peek_string but crop the result if it is more than 8 characters. |
Example: |
atom title title = allocate_string("The Wizard of Oz") ?peek_string(title) ... free(title) |
Example Program: | demo\arwendemo\demo_treeview.exw |
See Also: | allocate_string, allocate, free |