string copy | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

string copy

https://code.sololearn.com/cGXm7z6SiAhw/#cpp compile error: undeclared strcpy_s I don't know how to solve this.

3rd Aug 2019, 8:24 AM
김도현
김도현 - avatar
2 Answers
+ 1
`strcpy_s` is a function declared in string.h header, since you're writing in C++ you can #include <cstring> to have this function available. The #include <string> in your code includes the C++ string header, which contains definitions and declarations for C++ string (std::string class) Reference: https://en.cppreference.com/w/c/string/byte/strcpy Hth, cmiiw
3rd Aug 2019, 9:26 AM
Ipang
0
김도현 you should use header cstring instead of string....
3rd Aug 2019, 9:29 AM
Ketan Lalcheta
Ketan Lalcheta - avatar