Back to Blog
Back to Blog
VuGen Custom Function: xstrcat
Posted on Apr, 2009 by Admin
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Brian Wilson - TechSouth, LLC
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// xstrcat()
// more efficient version of strcat
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
char *xstrcat( char *dest, char *src )
{
while (*dest) dest++;
while (*dest++ = *src++);
return --dest;
}
/*char * xstrcat(char * dest, const char * src) // alternate version
{
char *tmp = dest;
while (*dest) dest++;
while ((*dest++ = *src++) != '\0');
return tmp;
}
*/
/* Example usage:
char str[80];
strcpy (str,"strings ");
xstrcat (str,"have been ");
xstrcat (str,"concatenated.");
lr_output_message("result: %s",str);
- - - - - - - - - - - - - - - - - - - - - - */