basic_string c_str 函数返回一个指向字符数组的指针,该字符数组使用空字符终止。它是一个内置方法,其值为具有空字符终止的字符串。在 C++ 中定义 c_str 函数的语法 - const Char ptr* c_str() const 关于该函数它是 c++ STL 库的内置方法。不能将参数传递给该方法。它返回一个 char 指针。此指针指向以 NULL 结尾的字符数组。示例实时演示 #include #include using namespace std; int main() { string s = "I Love Tutorials Point"; int ... 阅读更多