Visual C++.NET中的字符串转换方法(国外英文资料).docVIP

  • 4
  • 0
  • 约6.84万字
  • 约 17页
  • 2017-06-05 发布于河南
  • 举报

Visual C++.NET中的字符串转换方法(国外英文资料).doc

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

文档评论(0)

1亿VIP精品文档

相关文档