如何将数据从unsigned char指针复制到LPCTSTR? [英] How to copy data from unsigned char pointer to LPCTSTR ?

查看:179
本文介绍了如何将数据从unsigned char指针复制到LPCTSTR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将数据从



无符号字符指针复制到LPCTSTR?





LPCTSTR pBuf;



pBuf ia指向共享内存的指针每当我写内存时,我都会将pBuf增加4.



我只想将指针(pBuf)重置为初始位置(addr)at某点。



有谁知道怎么做?

Is it possible to copy a data from

unsigned char pointer to LPCTSTR ??


LPCTSTR pBuf ;

pBuf ia a pointer for shared memory ,whenever I do the memory write , I'll increment the pBuf by 4.

I just want to reset the pointer(pBuf) to initial position(addr) at some point.

Does anybody know How to do that ??

推荐答案

不可能使用 LPCTSTR varaibale。它是const( L ong P ointer C on T CHAR Str :它的类型为 const TCHAR * )。当尝试将数据复制到这样的指针时,编译器将生成错误。



但是您可以分配初始指针值(重置指针)或将其转换为另一个指针非const变量(你应该知道在将const转换为非const时你在做什么)。



你应该详细解释你想做什么和你要复制什么类型的数据。
It is not possible using the LPCTSTR varaibale. It is const (Long Pointer Const TCHAR String: it is of type const TCHAR *). The compiler will generate an error when trying to copy data to such a pointer.

But you can assign the initial pointer value (reset the pointer) or cast it to another non-const variable (you should really know what you are doing when casting const to non-const).

You should explain with more detail what you want to do and what kind of data you want to copy.


这篇关于如何将数据从unsigned char指针复制到LPCTSTR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆