What is the equivalent of strcpy in c++ and do I have to use a .h for it??
Printable View
What is the equivalent of strcpy in c++ and do I have to use a .h for it??
>> What is the equivalent of strcpy in c++ and do I have to use a .h for it??
I'd say strcpy();) in string.h
Some things just don't change.
And also std::strcpy() in <cstring> right?
I am using a c program with strcpy I want to convert it to c++ but I don't know the code for strcpy in C++
can anyone help
actually, wouldn't this be the equivalent?
where st1 and st2 are std::string ?Code:str1 = str2;
Only if they're declared as strings and not char*/char[], I think.Quote:
actually, wouldn't this be the equivalent?
code:--------------------------------------------------------------------------------
str1 = str2;
right, but a lot of people are looking for so-called C++ equivalences so I suppose it could be said that
char [] == std::string in C++
I don't really agree. I think C is mostly contained by C++ so I agree with TheDog on that one.
strcpy() == strcpy() in C++ as C is a rough subset of C++