Append the content of a char*-string to another char*-string - the content of s2 is appended to s1.
Append the content of a char*-string to another char*-string - the content of s2 is appended to s1. If the total size of s1 + s2 is larger than the buffer size, s1 is reallocated and adjust buffer size. The target string mst be allocated with alloc, the result string - unless it is zero - must be released using the release function.
Name | Type | Default | Description |
Return | pointer to target string s1 | ||
s1 | char* | - | target string |
s2 | char* | - | String to append |
bufferize | int* | - | size of memory allocated for the target string, |
This examples appends the content of a string with arbitrary length to another string.
int main() { int bufsize = 256; char * s1 = alloc(bufsize); char * s2 = "string with arbitrary length, might be much longer in real life"; int i = 0;
for (i = 0; i < 1000; ++i) { s1 = str_append(s1, s2, &bufsize); wlog ("", "str address: %d, buffer size: %d\n", s1, bufsize); } showmessage(s1);
release(s1); return 0; }
Alphabetic index HTML hierarchy of classes or Java