BOOTSTRAP (kutils) functions


LIBRARY ROUTINE

kstrcat - concatenate two strings

LIBRARY CALL

char *kstrcat(
   char       *ostr,
   const char *istr)

INPUT

OUTPUT

RETURN VALUE

A pointer to 'ostr' after all the characters in 'istr' are appended onto 'ostr'. It will return NULL if 'ostr' is NULL. If 'istr' is NULL, 'ostr' is returned unchanged.

DESCRIPTION

This function concatenates one string to another. kstrcat appends all the characters from 'istr' to the end of 'ostr', terminating the resulting string with a null character.

Note that the calling routine must make sure that 'ostr' points to a memory buffer large enough to hold the concatenated string and terminating null character. If the buffer is not large enough, memory will be overwritten resulting in unpredicable program failure.

ADDITIONAL INFORMATION

none

EXAMPLES

The following example contenates two strings 's1' and 's2', and to generate a well known sentence.
char  s1[KLENGTH] = { 'H', 'e', 'l', 'l', 'o' };
char *s2 = " World.\n";
char *result;

result = kstrcat(s1, s2); kprintf("%s", result);

The output is a single line saying 'Hello World', and the pointer 'result' is pointing to the 's1' array.

SIDE EFFECTS

none

RESTRICTIONS

none

MODIFICATION

none

FILES

$BOOTSTRAP/objects/library/kutils/src/strings.c

SEE ALSO

kutils(3)

COPYRIGHT

Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.