﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>学习日记 &#187; convert</title>
	<atom:link href="https://www.softwareace.cn/?feed=rss2&#038;tag=convert" rel="self" type="application/rss+xml" />
	<link>https://www.softwareace.cn</link>
	<description>时刻想着为自己的产品多做一些对他好的事情</description>
	<lastBuildDate>Fri, 20 Mar 2026 06:58:28 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>wchar_t* To std::string</title>
		<link>https://www.softwareace.cn/?p=511</link>
		<comments>https://www.softwareace.cn/?p=511#comments</comments>
		<pubDate>Thu, 18 Jul 2013 01:07:57 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[win32]]></category>
		<category><![CDATA[convert]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=511</guid>
		<description><![CDATA[[crayon-69fbd18401cec711840816/] &#160;]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">bool wcharToString(IN wchar_t* wText, OUT string&amp; str)
{
	//WideCharToMultiByte的运用 
	DWORD dwNum = WideCharToMultiByte(CP_OEMCP,NULL,wText,-1,NULL,0,NULL,FALSE);
	//psText为char*的临时数组，作为赋值给std::string的中间变量 
	char *psText;
	psText = new char[dwNum];
	// WideCharToMultiByte的再次运用 
	WideCharToMultiByte (CP_OEMCP,NULL,wText,-1,psText,dwNum,NULL,FALSE);
	//std::string赋值 
	str = psText; //大功告成
	//psText的清除 
	delete []psText;
	return true;
}</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=511</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
