0
問題很簡單:這段代碼有什麼用?wcscat_s函數 - 緩衝區錯誤
size_t buff = 1;
size_t new_buff;
WCHAR *var_path;
WCHAR *dir_path;
var_path = new WCHAR[buff];
new_buff = GetEnvironmentVariableW(L"APPDATA", var_path, buff);
if (new_buff == 0) {
return 1;
} else if (new_buff > buff) {
delete[] var_path;
var_path = new WCHAR[new_buff];
GetEnvironmentVariableW(L"APPDATA", var_path, new_buff);
}
dir_path = new WCHAR[new_buff];
wcscpy_s(dir_path, new_buff, var_path);
wcscat_s(dir_path, new_buff, L"\\directory");
它說,緩衝區是wcscat_s
這是解決方案,它非常簡單!謝謝。 – LppEdd