strcat_s, wcscat_s

From RAD Studio
Jump to: navigation, search

Go Up to string.h Index


Header File

string.h, _str.h

Category

Memory and String Manipulation Routines, Inline Routines

Prototype

errno_t *strcat(char * _RESTRICT dest, rsize_t destmax, const char * _RESTRICT src);

errno_t *wcscat(wchar_t * _RESTRICT dest, rsize_t destmax, const wchar_t * _RESTRICT src);

Description

Replaces Strcat, mbscat, wcscat adding security enhancements.

Appends one string to another.

strcat_s appends a copy not larger than destmax of src to the end of dest. Characters following '\0' are not copied. The length of the resulting string is strlen(dest) + strlen(src). If src and dest overlap, copying does not take place. If there is a run-time constraint violation, then dest[0] is set to null.

Return Value

strcat_s returns zero if successful, or nonzero otherwise.

Example

#include <string.h>
#include <stdio.h>
int main(void)
{
   char destination[25];
   char *c = "C++";
   char *Embarcadero = "Embarcadero";
   strcpy_s(destination, 12, Embarcadero);
   strcat_s(destination, 20, c);
   printf("%s\n", destination);
   return 0;
}

Portability

POSIX Win32 ANSI C ANSI C++

strcat_s

+

+

+

+

wcscat_s

+

+

+

See Also