What is use of c_str function In c++

前端 未结 7 1244
忘了有多久
忘了有多久 2020-12-04 06:30

I have just started reading C++ and found c++ having rich functions for string manipulation which C does not have. I am reading these function and came across c_str()<

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 06:43

    It's used to make std::string interoperable with C code that requires a null terminated char*.

提交回复
热议问题