设为首页 加入收藏

TOP

常用数据类型使用转换详解(三)
2014-11-23 20:15:01 来源: 作者: 【 】 浏览:167
Tags:常用 数据 类型 使用 转换 详解
转char*:
  char* lpszText = "Test";
  printf("char * text: %s\n", lpszText);
  BSTR bstrText = _com_util::ConvertStringToBSTR(lpszText);
  wprintf(L"BSTR text: %s\n", bstrText);
  SysFreeString(bstrText);
  char*转BSTR:
  BSTR bstrText = ::SysAllocString(L"Test");
  wprintf(L"BSTR text: %s\n", bstrText);
  char* lpszText2 = _com_util::ConvertBSTRToString(bstrText);
  printf("char * text: %s\n", lpszText2);
  SysFreeString(bstrText);
  delete[] lpszText2;


  编辑特别推荐:


  全国计算机等级考试资料下载


首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇errorLNK2005:……alreadydefined.. 下一篇C++实例:求2至N(2≤N≤500)之间..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: