> use _CRT_SECURE_NO_WARNINGS.
Perhaps you could google the last part of your error message.
It tells you how to turn off all the pointless M$ nagware and vendor lock-in traps.
> main.c(89): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead.
The problem with all this nonsense is that they're only SAFE if you know how to use them properly.
Which is exactly true of the original functions.
If "noob in a hurry" just passes useless "STFU" parameters to strncpy_s, then it's just as dangerous as strncpy is.
Code:
errno_t strncpy_s(
char *strDest,
size_t numberOfElements,
const char *strSource,
size_t count
);
...
char buff[10];
strncpy_s(buff,sizeof(buff),"hello world",10); // ok, but truncated string
So some dimwit comes along and tries to "fix" it by doing
Code:
strncpy_s(buff,100,"hello world",10); // yay!, I see the whole string
It's a small enough buffer overrun to potentially go unnoticed for quite some time.
All the warm fuzzy feel good of the _s functions won't do you any good at all if you don't know how to use them properly to begin with.