VuGen Custom Function: xstrcat

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// 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);
 
- - - - - - - - - - - - - - - - - - - - - - */

What's Next?

Did you enjoy this article? Help spread the word by sharing:

Join the Northway Navigator Club today and get access to restricted content including our best tips and tricks. Membership is free! You will also receive free email updates by registering.

Engage in the conversation and leave a comment:

Scott Moore

About Scott Moore (153 articles)

With over 20 years of IT experience with various platforms and technologies, Scott has tested some of the largest applications and infrastructures in the world. He is a Certified Instructor and Certified Product Consultant in HP’s LoadRunner and Performance Center products. He currently holds HP certifications for ASE, ASC, and CI. A thought leader in the APM space, he speaks regularly at IT conferences and events