Logo Search packages:      
Sourcecode: icu version File versions  Download package

U_STABLE UChar* U_EXPORT2 u_strncat ( UChar *  dst,
const UChar *  src,
int32_t  n 
)

Concatenate two ustrings. Appends at most n characters from src to dst. Adds a terminating NUL. If src is too long, then only n-1 characters will be copied before the terminating NUL. If n<=0 then dst is not modified.

Parameters:
dst The destination string.
src The source string.
n The maximum number of characters to append.
Returns:
A pointer to dst. ICU 2.0

Definition at line 639 of file ustring.c.

{
    if(n > 0) {
        UChar *anchor = dst;            /* save a pointer to start of dst */

        while(*dst != 0) {              /* To end of first string          */
            ++dst;
        }
        while((*dst = *src) != 0) {     /* copy string 2 over              */
            ++dst;
            if(--n == 0) {
                *dst = 0;
                break;
            }
            ++src;
        }

        return anchor;
    } else {
        return dst;
    }
}


Generated by  Doxygen 1.6.0   Back to index