<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://jackxiang.com/post//</link>
<title><![CDATA[c++中c_str()用法，越详细越好。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Tue, 23 Mar 2010 13:13:54 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	语法: <br/>const char *c_str();<br/>c_str()函数返回一个指向正规C字符串的指针, 内容与本string串相同. <br/>这是为了与c语言兼容，在c语言中没有string类型，故必须通过string类对象的成员函数c_str()把string 对象转换成c中的字符串样式。<br/>注意：一定要使用strcpy()函数 等来操作方法c_str()返回的指针 <br/>比如：最好不要这样: <br/>char* c; <br/>string s=&quot;1234&quot;; <br/>c = s.c_str(); //c最后指向的内容是垃圾，因为s对象被析构，其内容被处理<br/><br/>应该这样用： <br/>char c[20]; <br/>string s=&quot;1234&quot;; <br/>strcpy(c,s.c_str()); <br/>这样才不会出错，c_str()返回的是一个临时指针，不能对其进行操作<br/><br/>再举个例子<br/>c_str() 以 char* 形式传回 string 内含字符串<br/>如果一个函数要求char*参数，可以使用c_str()方法： <br/>string s = &quot;Hello World!&quot;;<br/>printf(&quot;%s&quot;, s.c_str()); //输出 &quot;Hello World!&quot;
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] c++中c_str()用法，越详细越好。]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>