- 4
- 0
- 约6.84万字
- 约 17页
- 2017-06-05 发布于河南
- 举报
VisualC.NET中的字符串转换方法(国外英文资料)
Visual C++.NET中的字符串转换方法
The string conversion method in Visual c+ + +.net
Visual c+ +.net involves a variety of programming methods, including ATL/ATL servers, MFC, and managed c + +, not only with a powerful and extensive application. In programming, we often encounter a string conversion operation of different encoding types, ANSI, Unicode, and BSTR. This paper first introduce the basic string type, then explains relevant classes, such as CComBSTR, _bstr_t, CStringT, finally discuss them transform method, which also include the use of the latest ATL7.0 transformation and macro, such as CA2CT, CA2TEX, etc.
One, BSTR, LPSTR, and LPWSTR
In all the programming styles of Visual c+ + +.net, we often use some of these basic string types such as BSTR, LPSTR, and LPWSTR. These types of data occur because of the data exchange between different programming languages and support for ANSI, Unicode, and multi-byte character sets (MBCS).
So what is BSTR, LPSTR, and LPWSTR?
The BSTR (Basic STRing, Basic STRing) is an OLECHAR * type of Unicode STRing. It is described as a type that is compatible with automation. Due to the operating system to provide the corresponding API functions (such as SysAllocString) to manage it and some default scheduling code, therefore BSTR is actually a COM string, but it is outside the automation technology is widely used a variety of occasions. Figure 1 depicts the structure of BSTR, where the DWORD value is the number of bytes that are actually occupied in a string, and its value is twice the number of Unicode characters in the string.
LPSTR and LPWSTR are the type of string data used in Win32 and vc + +. LPSTR is defined as a pointer to an array of 8-bit ANSI characters at the end of NULL ( \ 0 ), and LPWSTR is a 16-bit double-byte character array pointer to NULL. In vc + +, there are similar string types such as LPTSTR, LPCTSTR, and their meaning as shown in figure 2.
LPCTSTR refers to, for example, long pointer to a constant generic string, said
您可能关注的文档
- Cool Edit消音处理(国外英文资料).doc
- corejava 常用的类和方法(国外英文资料).doc
- coreldraw进修方法_CDR的十八种技能(国外英文资料).doc
- cpu设备与优化(国外英文资料).doc
- CRE物语专用版说明书(国外英文资料).doc
- CreateThread与_beginthread的区别(国外英文资料).doc
- CSS区分IE各版本以及火狐的写法(国外英文资料).doc
- css格局BUG大全(国外英文资料).doc
- cookie和session的作用及其区别(国外英文资料).doc
- Cstring转char、string、int等数据类型的方法(国外英文资料).doc
最近下载
- TSHJX 009-2020 上海市域铁路轨道工程施工技术规程(试行).docx VIP
- 康复规培考试试题及答案.doc VIP
- 2022风电工程建设标准工艺.docx VIP
- VW 50180_EN-2025 汽车内饰件排放性能.pdf
- API681石油,化工及气体工业用液环式真空泵和压缩机.pdf VIP
- 高级调饮师理论考试题及答案.doc VIP
- 2025年新人教版五年级下册道德与法治全册精编知识点(学生用).pdf
- TBAEE 004-2019 婴幼儿洗衣液.pdf VIP
- 《集成电路封装与测试技术》第5章 印制电路板.ppt VIP
- 人教版(2024)新教材小学三年级美术下册第一单元《第1课 水火土的猜想》精品课件.pptx
原创力文档

文档评论(0)