请问如何将'class CString *'转化为'const char *',多谢了
解决方案 »
- 大家推荐一些hook方面的资料
- 协议驱动的简单问题!谁帮我解决我送150分!急!
- 添加了一个对话框资源后出现的问题!!偶是刚开始学习用VC6
- _sleep(100) 是不是会因机器忙而不准确?
- 如何得到数据采集卡的中断请求和输出范围?
- 关于dll一个疑难杂症!
- 用WinInet做的http客户端应用,老是12029错误,怎么办?
- 双击CEdit某行,如何返回行号?
- CMake编译明明system32下有glu32.lib与opengl32.lib//project files may be invalid.....
- 大家谁有兴趣编写一个可以通过路由器感染的病毒
- 请问如何调出CFromView的资源
- 最简单的问题
const char* tmpsz = LPCTSTR(*tmpStr)
str->GetBuffer();
例如:
CString a;
a="abc";
char *b;
b=(LPCTSTR)a;
这时b中都数据时"abc"
C++ Specific —>reinterpret_cast < type-id > ( expression )The reinterpret_cast operator allows any pointer to be converted into any other pointer type, and it allows any integral type to be converted into any pointer type and vice versa. Misuse of the reinterpret_cast operator can easily be unsafe. Unless the desired conversion is inherently low-level, you should use one of the other cast operators.END C++ Specific
CString str("aaa"); szText = str.GetBuffer(str.GetLength());
releasebuffer()
否则的话可能要用WideCharToMultiBytes