Difference between revisions of "Prokee Module: mstr"
Jump to navigation
Jump to search
(Created page with "The module '''mstr''' provides basic functionality for strings (like copying, concatenation and comparison) with automated reallocation of larger memory blocks, if required....") |
|||
| Line 1: | Line 1: | ||
The module '''mstr''' provides basic functionality for strings (like copying, concatenation and comparison) with automated reallocation of larger memory blocks, if required. | The module '''mstr''' provides basic functionality for strings (like copying, concatenation and comparison) with automated reallocation of larger memory blocks, if required. | ||
| + | |||
| + | == Example == | ||
| + | mstrs<char> *a; | ||
| + | mstr::create(&a,10); // initial memory allocation of 10 Bytes | ||
| + | mstr::copy_str(a,"Hello World!"); // copying of a string (allocates a larger memory block for 'a') | ||
| + | printf("%s\n",mstr::c_str(a)); | ||
| + | mstr::destroy(a); // frees all memory allocated for 'a' | ||
== Implementations == | == Implementations == | ||
Revision as of 13:04, 12 June 2019
The module mstr provides basic functionality for strings (like copying, concatenation and comparison) with automated reallocation of larger memory blocks, if required.
Example
mstrs<char> *a;
mstr::create(&a,10); // initial memory allocation of 10 Bytes
mstr::copy_str(a,"Hello World!"); // copying of a string (allocates a larger memory block for 'a')
printf("%s\n",mstr::c_str(a));
mstr::destroy(a); // frees all memory allocated for 'a'