1.const char* p: p is a pointer to const char(char const* p 一样) 意思就是不能通过p指针来修改p指向的内容(但是内容可以修改). 2.char* p : p is a pointer to char 意思就是可通过p指针来修改p指向的内容 3.char* const p: p is a const pointer to char 意思就是p指针是一个常指针,他指向的内存地址不能变,定义的时候就得初始化 一旦给
std::string stringf(const char* format, ...){ va_list arg_list; va_start(arg_list, format); // SUSv2 version doesn't work for buf NULL/size 0, so try printing // into a small buffer that avoids the double-rendering and alloca path too... char short_b
How to convert a std::string to const char* or char*? 1. If you just want to pass a std::string to a function that needs const char* you can use std::string str; const char * c = str.c_str(); If you want to get a writable copy, like char *, you can d