Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>strcpy() copy one string to another</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 strcpy()                Copy One String to Another

 #include   <string.h>                   Required for declarations only

 char       *strcpy(string1,string2);
 char       *string1;                    Destination string
 const char *string2;                    Source string

    strcpy() copies the contents of 'string2' to 'string1'. The
    terminating null character ('\0') is also copied.

       Returns:     A pointer to 'string1'.

         Notes:     strcpy() expects to operate on null-terminated
                    strings.  No overflow checking is done when strings
                    are copied or appended.

                    strcpy() is the same as stpcpy() except that stpcpy
                    also returns the length of 'string2'.

   -------------------------------- Example ---------------------------------

    This example copies the string "SUMMARY" into 'str1'.

           #include <string.h>
           #include <stdio.h>

           char str1[25];

           main()
           {
               strcpy(str1,"SUMMARY");
               printf("%s",str1);
           }


See Also: strncpy() stpcpy()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson