CString怎么转成LPVOID的问题 vc/mfc

来源:互联网 发布:人工智能三定律 编辑:程序博客网 时间:2024/05/29 11:58

获取CString类的对象存储空间的首地址,再把首地址转化成LPVOID型 最后释放Buffer空间

 

CString   str( "abgctetgaf "); 
LPSTR   lpstr=str.GetBuffer(0); 
LPVOID   lpvoid=(LPVOID)lpstr; 
str.ReleaseBuffer();

 

 

其中:

  • LPSTR   A 32-bit pointer to a character string.
  • (一个32位的指向一个字符串的指针)
  • LPVOID   A 32-bit pointer to an unspecified type.
  • (一个32位的指向一个不确定的类型,或是理解为指向的类型为空,也即任意类型)
  • 原创粉丝点击