⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ustring.cpp

📁 从Visual C++中用Access自动生成报表
💻 CPP
字号:
///////////////////////////////////////////////////////////////////////////////
//
// ustring.cpp - Copyright 1997, Don Box
//
// This file contains the implementation of several conversion routines 
// that are used by the String816 class for duplicating/converting strings
// on the fly.
//
//     uxdup(const char *psz) - returns a new-ed wchar_t string based on psz
//     uxdup(const wchar_t *psz) - returns a new-ed char string based on psz
//     


#include <stdafx.h> 

#ifndef _USTRING_CPP
#define _USTRING_CPP


wchar_t *uxdup(const char *psz)
{
    size_t cch = strlen(psz) + 1;
    wchar_t *pwszResult = (wchar_t*)malloc(cch * sizeof(wchar_t));
    if (pwszResult)
        mbstowcs(pwszResult, psz, cch);
    return pwszResult;
}

char *uxdup(const wchar_t *pwsz)
{
    size_t cch = wcslen(pwsz) + 1;
    char *pszResult = (char*)malloc(sizeof(char) * cch);
    if (pszResult)
        wcstombs(pszResult, pwsz, cch);
    return pszResult;
}


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -