zoukankan      html  css  js  c++  java
  • vc6到 vs2008 char* 与 CString 之间 字符串转换函数 .

    从vc6到 vs2008 字符串转换是表麻烦,于是参考相关资料,写了两个函数。

    char*
    CString的转换


    CString MCharToCString(char* szChar)
    {
        CString strValue;
        int nLen=0;
        nLen= MultiByteToWideChar(CP_ACP, 0, szChar, -1, NULL, 0);
        WCHAR wBuf[1024];
        MultiByteToWideChar(CP_ACP, 0, szChar, -1, wBuf, nLen);
        strValue.Format(_T("%s"),wBuf);
        return strValue;
    }

    CString与char*的转换

    char*  CStringToMChar(CString str)
    {
        char szChar[1024];  
        int nlen=0;
        memset(szChar,0x00,1024);
        nlen=WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
        WideCharToMultiByte(CP_ACP, 0, str, -1, szChar, nlen, NULL, NULL);
        return szChar;
    }
  • 相关阅读:
    SAP Easy tree
    SAP Column tree
    SAP Tree
    SAP 文本框多行输入
    SAP -SE30 程序运行时间分析
    SAP 实例- 页签tabsrip
    ABAP CDS
    ABAP CDS
    ABAP CDS
    ABAP CDS
  • 原文地址:https://www.cnblogs.com/jinsedemaitian/p/5589177.html
Copyright © 2011-2022 走看看