当我尝试使用该strcpy功能时,视觉工作室给我一个错误
error C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
Run Code Online (Sandbox Code Playgroud)
在网上搜索和 StackOverflow 的许多答案之后,总结是这比将大字符串复制到较短的字符串strcpy_s更安全。strcpy因此,我尝试使用以下代码来处理较短的字符串:
char a[50] = "void";
char b[3];
strcpy_s(b, sizeof(a), a);
printf("String = %s", b);
Run Code Online (Sandbox Code Playgroud)
那么,怎样才scrcpy_s安全呢?我对安全概念的理解错误吗?