MiniGUI API Reference (MiniGUI-Processes)  v3.2.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
Functions
Length-Fixed string operations

Functions

MG_EXPORT char *GUIAPI FixStrAlloc (int len)
 Allocates a buffer for a length-fixed string. More...
 
MG_EXPORT char *GUIAPI FixStrDup (const char *str)
 Duplicates a length-fixed string. More...
 
MG_EXPORT void GUIAPI FreeFixStr (char *str)
 Frees a length-fixed string. More...
 

Detailed Description

MiniGUI maintains a private heap for length-fixed strings, and allocates length-fixed strings from this heap for window caption, menu item text, and so on. You can also use this private heap to allocate length-fixed strings.

char * buffer = FixStrAlloc (strlen ("Hello, world!"));
if (buffer)
strcpy (buffer, "Hello, world!");
...
FreeFixStr (buffer);

Function Documentation

char *GUIAPI FixStrAlloc ( int  len)

Allocates a buffer for a length-fixed string.

This function allocates a buffer from the length-fixed string heap for a string which is len bytes long (does not include the null character of the string).

Note
You can change the content of the string, but do not change the length of this string (shorter is valid) via strcat function or other equivalent functions or operations.
Parameters
lenThe length of the string.
Returns
The pointer to the buffer on success, otherwise NULL.
See also
FreeFixStr
char *GUIAPI FixStrDup ( const char *  str)

Duplicates a length-fixed string.

This function allocates a buffer from the length-fixed string heap and copy the string str to the buffer.

Note
You can change the content of the string, but do not change the length of this string (shorter is valid) via strcat function or other equivalent functions or operations.
Parameters
strThe pointer to the string will be duplicated.
Returns
The pointer to the buffer on success, otherwise NULL.
See also
FreeFixStr
void GUIAPI FreeFixStr ( char *  str)

Frees a length-fixed string.

This function frees the buffer used by the length-fixed string str.

Parameters
strThe length-fixed string.
Note
Do not use free to free the length-fixed string.
See also
FixStrAlloc