(12) : warning 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.

I get it when I compile, it compiles it successfully, but it says this function may be unsafe, why is that? Deprecation? Hmm...

Code:

int main ( )
{

char TestSrc[] = "Test1234";
char TestDst[20];

strcpy(TestDst, TestSrc);

}

Thats my code, I was just messing around with string functions, so I can have a better understanding of C++

07-28-2008

tabstop

strcpy_s is a Microsoft-specific version of strcpy that has extra checks to help make sure you don't screw things up. You can find the specifics in the online help, as mentioned. (In this case, there's nothing wrong with what you've got.)

07-28-2008

bobbelPoP

Quote:

Originally Posted by tabstop

strcpy_s is a Microsoft-specific version of strcpy that has extra checks to help make sure you don't screw things up. You can find the specifics in the online help, as mentioned. (In this case, there's nothing wrong with what you've got.)

Oh, great! Thanks:D So you could tell I use VS :P

07-28-2008

cpjust

If Microsoft doesn't like a standard, they just make up some bullsh** to confuse & annoy people.
Unless you really feel like throwing portability out the 'windows', just define _CRT_SECURE_NO_WARNINGS and use the standard function.

07-28-2008

bobbelPoP

Quote:

Originally Posted by cpjust

If Microsoft doesn't like a standard, they just make up some bullsh** to confuse & annoy people.
Unless you really feel like throwing portability out the 'windows', just define _CRT_SECURE_NO_WARNINGS and use the standard function.