将LPVOID转换为UNICODE

将LPVOID转换为UNICODE

本文介绍了将LPVOID转换为UNICODE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我们如何将LPVOID 转换为UNICODE 即将LPVOID 转换为wchar_t*/TCHAR*吗?我们正在通过空指针获取数据,但需要将其显示为Unicode(ARABIC).我们已经尝试了以下方法,但是它不起作用:

Can somebody tell that how can we convert LPVOID to UNICODE i.e. Convert LPVOID to wchar_t* / TCHAR* ? We are getting data in a void pointer but need to display as Unicode (ARABIC). We have tried following but it does not work:

wchar_t* Function(void* source, int ilen)
{
  wchar_t* l_pDestination = new wchar_t[ilen+1];
  memset(l_pDestination,0,ilen+1);
  mbstowcs(l_pDestination,source,ilen+1);
  return l_pDestination;
}


请帮忙.


Please help.

推荐答案

TCHAR* unicodeString = (TCHAR*)myPointer;



但是,当然,这实际上与您在指针中放置的内容无关...

编辑完消息后,我仍然有相同的问题:到底是什么指向源指针?这是给您正确答案的关键.
此外,您说这行不通,能否解释您得到的内容和期望的内容?



But of course, this really depends no what you have put in your pointer...

after you edited your message, I still have the same question: to what is pointing the source pointer exactly ? That''s the key to give you a correct answer.
Furthermore, you say it doesn''t work, can you explain what you get and what you expected ?




这篇关于将LPVOID转换为UNICODE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 21:33