Append content of a char*-string to another char*-string.

Append content of a char*-string to another char*-string. If the total size of s1 + s2 is larger than buffer size, reallocate s1 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; }

Since
Version 4.0.5 (19.11.2015)

Available
priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

See Also
strcpy
strcat
strncat

Alphabetic index HTML hierarchy of classes or Java