使用wcscpy_s第二个参数在使用wcscpy_s这些之类的函数时,如果DesBuf是数组,记得用_countof求长度。例如:#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 ); }版权声明:本文为danxuezx原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。原文链接:https://blog.csdn.net/danxuezx/article/details/5223524