将指针的值放入CString [英] Put the value of a pointer into a CString

查看:78
本文介绍了将指针的值放入CString的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CComQIPtr spHst; 

HRESULT hr1 = CoCreateInstance( CClsid::m_CSFTHST, NULL, CLSCTX_LOCAL_SERVER, IID_ICSFTHST, (void **)&spHst); 



而不是每次都要调试,我想将spHst的值写入日志文件.所以我想将spHst的值放入CString变量中.我该怎么办?

无论如何,我还能检查指针spHst是否指向有效位置吗?



Instead to debugging every time, i want to write the value of spHst to a log file. So i want to put the value of spHst into a CString variable. how do i do that?

Also is there anyway i can check if the pointer spHst is pointing to a valid location?

推荐答案

这里有一个例子:

Here''s an example:

int a;
int* p = &a;
CString s;
s.Format(L"%p", p);


这篇关于将指针的值放入CString的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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