std::strcpy is not a member

Marc Glisse
Tue Feb 23 23:54:00 GMT 2010

On Tue, 23 Feb 2010, Kevin P. Fleming wrote:

> Vardhan, Sundara (GE Infra, Energy) wrote:

>> #include <stdio.h>
>> #include <string.h>
[then use std::strcpy]

> This is not C++, it's C. If you want the C-style string functions
> available in the C++ 'std' namespace, you must do:
> #include <cstring>

It is also perfectly valid C++03. Now most compilers never implemented 
this properly, and C++0X validates that behavior, so the code won't be 
valid C++0X. But then, IIRC, C++0X also undeprecates the inclusion of 
string.h, so the OP might as well keep including string.h and use 
strcpy (without std::).

Marc Glisse

More information about the Gcc-help mailing list