#ifdef _WIN32 _invalid_parameter_handler old_invalid_param_handler; void invalid_param_ignore(const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t pReserved) { if (!wcscmp(function, L"strcpy_s") return; old_invalid_param_handler(); } #endif ... somewhere in main()... #ifdef _WIN32 old_invalid_parameter_handler = _set_invalid_parameter_handler(invalid_param_ignore); #endif