c_str() 函数

包含文件:string.h
函数名: c_str
功能:string转char数组
 
用法:
char c[20]; 
string s="1234";
strcpy(c,s.c_str());
这样才不会出错,c_str()返回的是一个临时指针,不能对其进行操作
posted @ 2014-05-19 10:20  蓝夜  阅读(247)  评论(0编辑  收藏  举报