嚴重性 代碼 說明 項目 文件 行 禁止顯示狀態
錯誤 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.
出現這個報錯是因爲使用了strcpy,這個是VS覺得它不安全,現在要逐漸棄用了。編譯器提示建議使用strcpy_s,這個更安全的寫法,但是會提示不支持兩個參數的錯誤。
解決方法是加上這麼一行代碼
#pragma warning(disable:4996)
另外,在C語言中要包含的是
#include<string.h>
若是使用C++,則
#include<cstring>