我们如何将字符串转换为LPVOID? [英] How we convert string to LPVOID?

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

问题描述

我想将字符串转换为LPVOID.

string strData = "Some Data";
LPVOID lpBuffer = (LPVOID)strData.c_str();


但是它不会在lpBuffer中显示任何数据.

请帮帮我.

谢谢,
Avikal

解决方案

您在哪里寻找"lpBuffer中的任何数据"?只需查看内存中的lpBuffer地址即可.正如您在 Jast_in 所说的那样,在将值分配给void指针的行之后设置一个断点.选择Debug -> Windows -> Memory,然后选择一个内存窗口.在这里输入void指针的地址.


我正在通过WinHttpSendRequest方法将LpBuffer的数据发送到网页.在这种方法中,我必须以LPVOID的形式传递数据,并且正在从文本文件中读取数据,而该文本文件是以字符串格式获取的,这就是为什么我需要这种转换的原因.


I want to convert a string to LPVOID.

string strData = "Some Data";
LPVOID lpBuffer = (LPVOID)strData.c_str();


But it does not show any data in lpBuffer.

Please help me.

Thanks,
Avikal

解决方案

Where do you look for "any data in lpBuffer"? Just look at memory for address of your lpBuffer. It got your "Some Data" :)


As Jast_in said, set a breakpoint after the line assigning the value to the void pointer. The select Debug -> Windows -> Memory and select a memory window. Here type in the address of the void pointer.


I am sending the data of LpBuffer to a web page via using method WinHttpSendRequest. In this method I have to pass the the data in the form of LPVOID and I am reading data from a text file which I get in string format that why I need this conversion.


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

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