C++ deprecated conversion from string constant to 'char*'

前端 未结 11 1353
傲寒
傲寒 2020-11-22 16:01

I have a class with a private char str[256];

and for it I have an explicit constructor:

explicit myClass(const char *func)
{
    strcpy(         


        
11条回答
  •  旧时难觅i
    2020-11-22 16:33

    Maybe you can try this:

    void foo(const char* str) 
    {
        // Do something
    }
    
    foo("Hello")
    

    It works for me

提交回复
热议问题