PostHeaderIcon char* and wchar_t* conversion for each other

This test is under unicode environment. We use _bstr_t for each conversion.
Let us see the code, easy:

#include "comutil.h"
#pragma comment(lib,"comsuppw.lib")

int main()
	char* sc="hellochar";
	wchar_t* sw=L"hellowchart";

	_bstr_t bsc(sc);
	_bstr_t bsw(sw);

	// wchar_t* to char*
	char* bc=bsw;

	// char* to wchar_t*
	wchar_t* bw=bsc;

	return 0;

Leave a Reply

Your email address will not be published. Required fields are marked *



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyright © 2010 - C++ Technology. All Rights Reserved.

Powered by Jerry | Free Space Provided by