Compiler Error: Function call with parameters that may be unsafe
The warning is telling you that you risk a buffer overflow if n
is too large -- which you know can't happen because of the way you just computed with a min
, but the poor commpiler doesn't. I suggest you take the compiler's own advice and use -D_SCL_SECURE_NO_WARNINGS
for this one source file...
Check out this MSDN page for documentation on the warning
The MS C++ compiler decided to deprecate the method std::string::copy because it is potentially unsafe to use and can lead to a buffer overrun. This deprecation is Microsoft specific and you will likely not see it on other compiler platforms.