VS2010中各种类型的转换.docxVIP

  • 26
  • 0
  • 约2.08万字
  • 约 18页
  • 2018-11-05 发布于福建
  • 举报
VS2010中各种类型的转换

VS2010中各种类型的转换此示例演示如何从 char * 转换为上面列出的其他字符串类型。 char * 字符串(也称为 C 样式字符串)使用 null 字符指示字符串的末尾。 C 样式字符串通常每个字符需要一个字节,但也可以使用两个字节。 在下面的示例中,char * 字符串有时称为多字节字符字符串,因为该字符串数据是从 Unicode 字符串转换得到的。 可对 char * 字符串执行单字节和多字节字符 (MBCS) 函数运算。 代码复制 // convert_from_char.cpp// compile with: /clr /link comsuppw.lib#include iostream#include stdlib.h#include string#include atlbase.h#include atlstr.h#include comutil.husing namespace std;using namespace System;int main(){ // Create and display a C style string, and then use it // to create different kinds of strings. char *orig = Hello, World!; cout orig (char *) endl;

文档评论(0)

1亿VIP精品文档

相关文档