Modification format .
Copy the char array to string.
Example 1 (copying all the masive starting with the zero index):
CODE:
char a [5];
a [0] = 'q';
a [1] = 'w';
a [2] = 'e';
a [3] = 'r';
a [4] = 't';
string s = format (#a [0]); // Copy the whole array to zero (when a [...] == 0). Indicates the end of a line
messagebox (s);
a [0] = 'q';
a [1] = 'w';
a [2] = 'e';
a [3] = 'r';
a [4] = 't';
string s = format (#a [0]); // Copy the whole array to zero (when a [...] == 0). Indicates the end of a line
messagebox (s);
In s the string qwert
The end of the line is set automatically.
or
Example 2 (copying a part of the masive starting from a nonzero index):
CODE:
char a [5];
a [0] = 'q';
a [1] = 'w';
a [2] = 'e';
a [3] = 'r';
a [4] = 't';
string s = format (#a [2], 3); // Specify by the second parameter the number of elements to be copied
messagebox (s);
// In s the string ert
char a [5];
a [0] = 'q';
a [1] = 'w';
a [2] = 'e';
a [3] = 'r';
a [4] = 't';
string s = format (#a [2], 2); // Specify by the second parameter the number of elements to be copied
messagebox (s);
a [0] = 'q';
a [1] = 'w';
a [2] = 'e';
a [3] = 'r';
a [4] = 't';
string s = format (#a [2], 3); // Specify by the second parameter the number of elements to be copied
messagebox (s);
// In s the string ert
char a [5];
a [0] = 'q';
a [1] = 'w';
a [2] = 'e';
a [3] = 'r';
a [4] = 't';
string s = format (#a [2], 2); // Specify by the second parameter the number of elements to be copied
messagebox (s);
// In s the string er
If the copy does not come from the zeroth index, you need to put the second parameter, since otherwise the data that goes further in the memory will be copied.
[url=http://kibor-bot.com/forum/topic.php? forum = 1 & topic = 4 & postid = 1374765027 # 1374765027] Other features format [/url]
[url=http://kibor-bot.com/forum/topic.php? forum = 1 & topic = 4 & postid = 1375046083 # 1375046083] Convert string to array char [/url]