Convert char* to string C++

后端 未结 5 1967
轮回少年
轮回少年 2021-01-31 03:29

I know the starting address of the string(e.g., char* buf) and the max length int l; of the string(i.e., total number of characters is less than or equ

5条回答
  •  再見小時候
    2021-01-31 03:59

    std::string str;
    char* const s = "test";
    
    str.assign(s);
    

    string& assign (const char* s); => signature FYR

    Reference/s here.

提交回复
热议问题