64,648
社区成员
发帖
与我相关
我的任务
分享
// crt_strcpy_s.cpp
// This program uses strcpy_s and strcat_s
// to build a phrase.
//
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
int main( void )
{
char string[80];
// using template versions of strcpy_s and strcat_s:
strcpy_s( string, "Hello world from " );
strcat_s( string, "strcpy_s " );
strcat_s( string, "and " );
// of course we can supply the size explicitly if we want to:
strcat_s( string, _countof(string), "strcat_s!" );
printf( "String = %s\n", string );
}