拙网论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 114|回复: 0

CString 转char[]

[复制链接]

949

主题

1001

帖子

3736

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3736
发表于 2018-8-10 18:13:55 | 显示全部楼层 |阅读模式

VS2017. MFC获取EditBox的值,转为char[];


char A[255];
        char B[255];

        CString str_A;
        CString str_B;

        GetDlgItem(IDC_EDIT1)->GetWindowText(str_A);
        GetDlgItem(IDC_EDIT2)->GetWindowText(str_B);

        strcpy_s(A, CStringA(str_A).GetString());
        strcpy_s(B, CStringA(str_B).GetString());


https://stackoverflow.com/questions/785187/convert-cstring-to-character-array
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|抱朴守拙BBS

GMT+8, 2025-5-26 07:21 , Processed in 0.209894 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表