Thread: strcpy

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    141

    strcpy

    What does this mean:
    Code:
    (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++

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    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.)

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    141
    Quote Originally Posted by tabstop View Post
    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 So you could tell I use VS :P

  4. #4
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    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.

  5. #5
    Registered User
    Join Date
    May 2008
    Posts
    141
    Quote Originally Posted by cpjust View Post
    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.
    That's ass.. Oh well, if the compiler ..........es again, it doesn't matter.


    Edit: Lol Censors.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A Full Program to analyze.
    By sergioms in forum C Programming
    Replies: 2
    Last Post: 12-30-2008, 09:42 AM
  2. Strcpy
    By Godders_2k in forum C Programming
    Replies: 17
    Last Post: 12-12-2007, 12:34 PM
  3. Where is strcpy() defined? (Can't find in string.h ect)
    By Zero_Point in forum C++ Programming
    Replies: 6
    Last Post: 04-03-2006, 05:14 PM
  4. Question about strcpy
    By Kevinmun in forum C Programming
    Replies: 4
    Last Post: 11-02-2005, 11:00 PM
  5. strcpy
    By Luigi in forum C++ Programming
    Replies: 17
    Last Post: 02-16-2003, 04:11 PM