CONCAT

Section: C Library Functions (3)
Updated: 2/22/89
Index Return to Main Contents
 

NAME

concat, vconcat - concatenate strings into a buffer  

SYNOPSIS

char *concat(buf, buflen, str1, str2, ..., NULL);

char *buf;
int buflen;
char *str1, *str2, ...; #include <varargs.h> char *vconcat(buf, buflen, ap)
char *buf;
int buflen;
va_list ap;
 

DESCRIPTION

Concat takes a list of string pointers and concatenates them into a buffer. The string pointers are terminated by a NULL (0) string pointer. Buf should be a buffer of length buflen that will contain the concatenation of the string pointers.

Concat will return NULL if buf is NULL, if buflen is <= 0, or if the concatenation of the string pointers did not fit into buf. In all other cases, concat will terminate the concatenation with a null (0) byte and return a pointer to the null byte.

Vconcat is a varargs version of concat which may be used by routines to concatenate their string pointer argument list into a buffer.  

EXAMPLES

end = concat(buf, buflen, dir, "/", file, NULL);

could be used to generate a file path from a directory name and a file name, returning a pointer to the end of the path.

concat(end, buf+buflen-end, ".", ext, NULL);

could then be used to add an extension to the file path.  

SEE ALSO

strcat(3), strcpy(3), sprintf(3)


 

Index

NAME
SYNOPSIS
DESCRIPTION
EXAMPLES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 12:50:32 GMT, May 26, 2025