当前位置:网站首页>MFC CString to char*
MFC CString to char*
2022-07-02 14:56:00 【sam-zy】
/// <summary>
/// CString turn char*
/// </summary>
/// <param name="str"> Input CString type </param>
/// <returns> Converted char* type </returns>
char* CStringToCharArray(CString str)
{
int n;
n = WideCharToMultiByte(CP_OEMCP, 0, str, -1, NULL, 0, 0, FALSE); // Wide byte to multi byte
char* SendInt = new char[n];
memset(SendInt, 0, n * sizeof(char)); // initialization pSend
WideCharToMultiByte(CP_OEMCP, 0, str.GetBuffer(0), n, SendInt, n, 0, FALSE);
str.ReleaseBuffer(); // Release cache
return SendInt;
}
边栏推荐
猜你喜欢
taobao.trade.memo.add( 对一笔交易添加备注 )接口,淘宝店铺插旗接口,淘宝订单插旗API接口,oAuth2.0接口
Xilinx Vivado set *. svh as SystemVerilog Header
C语言习题---(数组)
蜻蜓低代码安全工具平台开发之路
Uniapp automated test learning
Simple verification code generator for 51 single chip microcomputer experiment
使用mathtype编辑公式,复制粘贴时设置成仅包含mathjax语法的公式
[apipost] tutorial
Kityformula editor configure font size and spacing
途家木鸟美团夏日折扣对垒,门槛低就一定香吗?
随机推荐
geoserver离线地图服务搭建和图层发布
mathjax 入门(web显示数学公式,矢量的)
socket(套接字)与socket地址
Tmall product details interface (APP, H5 end)
C语言中的printf函数和scanf函数
C#延时、在线程中开启定时器、获取系统时间
Fundamentals of software testing
Implement a server with multi process concurrency
Reuse and distribution
Database connection pool and data source
btrace-(字节码)动态跟踪工具
LeetCode_字符串_简单_412.Fizz Buzz
C# richTextBox控制显示最大行数
Actual combat sharing of shutter screen acquisition
threejs的控制器 立方体空间 基本控制器+惯性控制+飞行控制
MFC A对话框调用B对话框函数并传参
求轮廓最大内接圆
Fabric.js 橡皮擦的用法(包含恢复功能)
Development and design of animation surrounding mall sales website based on php+mysql
buuctf-pwn write-ups (7)