|
| |||||||||
| Tags: cpp, functions, header files, library, strcpy, string |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Use of the strcpy() in the C++
Hello, How are you all!!! I am working in the ABC software company as a software developer. I had learned the C++ language in my college day's. I also can be familiar with the most of the functions of the C++ language. So, I want to know about the strcpy() function of the C++. I also want to know the use of the C++ language. Can anyone knows about the strcpy() function of the C++ language. |
|
#2
| ||||
| ||||
| The strcpy() in the C++
The strcpy() function of the C++ language can be used to copy the given specified string. The strcpy() function can copies the string that can be pointed by the source of the string into an array of the string that can be pointed by the destination of the string including the character that can be null. The following can be the syntax of the strcpy() function as : Code: char * strcpy ( char * dstntn, const char * src ); |
|
#3
| |||
| |||
| Use of the strcpy()
The following can be the parameters of the strcpy() function of the C++ language : 1. src : This parameter of the strcpy() function of the C++ language can contains the string that can be copied into the specified destination. 2. dstntn : This parameter of the strcpy() function of the C++ language can contains the pointer to the destination array where the content can have to be copied. |
|
#4
| ||||
| ||||
| The strcpy()
The program that can be mentioned below describes you that how to make the use of strcpy() function into the C++ language : Code: #include <stdio.h>
#include <string.h>
int main ()
{
char sr1[]="Sample string";
char sr2[40];
char sr3[40];
strcpy (sr2,sr1);
strcpy (sr3,"copy successful");
printf ("sr1: %s\nsr2: %s\nsr3: %s\n",sr1,sr2,sr3);
return 0;
} Code: sr1: Sample string sr2: Sample string sr3: copy successful |
|
#5
| ||||
| ||||
| Re: Use of the strcpy() in the C++
I think the following points can explains you about the strcpy() function more deeply and easily : 1. The strcpy() function can copies the characters that can be in the source string variable into the destination string variable including the null character termination. 2. The strcpy() function can returns the value that can be a destination value. 3. The risks can overrunning from or to, because of the strcpy() function can not performs the bounds checking. |
|
#6
| ||||
| ||||
| Use of the strcpy() in the C++
The code of lines that can be listed below can defines you about the strcpy() function of the C++ language : Code: #include <stdio.h>
#include <string.h>
int main()
{
char inptsr[] = "Hello";
char *otptsr;
otptsr = strcpy(iptsr, "World");
printf("iptsr: %s\n", iptsr);
printf("otptsr: %s\n", otptsr);
return 0;
} Code: inptsr: World otptsr: World |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Use of the strcpy() in the C++" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Difference : strdup and strcpy | Adene | Software Development | 4 | 30-01-2010 11:20 AM |