当前位置:网站首页>MFC on the conversion and display of long string unsigned char and CString
MFC on the conversion and display of long string unsigned char and CString
2022-07-06 06:18:00 【Laobai 436196571】
Today I met about MD5 Generate registration code input and display problems , The solution process is recorded below
1、 Dialog window input CString turn unsigned char Array
CString regstr;
unsigned char reg_code[20]="1234";// Test array
unsigned char reg_code_md5[20];
union TRAN_DATA
{
char c_data;
unsigned char uc_data;
};
TRAN_DATA tran_data;
GetDlgItemText(IDC_EDIT_writereg,regstr);// Dialog input
DWORD dwNum = WideCharToMultiByte(CP_OEMCP,NULL,regstr.GetBuffer(),-1,NULL,0,NULL,FALSE);
char *c_user_data = new char[dwNum];
unsigned char *uc_user_data = new unsigned char[dwNum];
memset( c_user_data,0 ,dwNum);
WideCharToMultiByte (CP_OEMCP,NULL,regstr.GetBuffer(),-1,c_user_data,dwNum,NULL,FALSE);
for(int i=0;i<dwNum;i++)
{
tran_data.c_data=c_user_data[i];
uc_user_data[i]=tran_data.uc_data;
}
Write_Regcode(card_no[0],uc_user_data,reg_code_md5);
//Write_Regcode(card_no[0],reg_code,reg_code_md5);// Test whether direct input is the same as dialog input
delete[] c_user_data;
delete[] uc_user_data;
c_user_data=NULL;
uc_user_data=NULL;
2、 The dialog window displays MD5 code ,unsigned char Array rotation CString, The dialog box shows the output
CString str;
CString str0;
// for ( int i = 0; i < sizeof (reg_code_md5) / sizeof (reg_code_md5[0]); i++)
for ( int i = 0; i < 16; i++)
{
str0.Format(_T("%02X"),reg_code_md5[i]);
str +=str0;
}
SetDlgItemText(IDC_EDIT_readreg,str);
3、 test (MD5 Registration code after adding salt )
边栏推荐
- 黑猫带你学UFS协议第4篇:UFS协议栈详解
- 全程实现单点登录功能和请求被取消报错“cancelToken“ of undefined的解决方法
- Isam2 operation process
- keil MDK中删除添加到watch1中的变量
- Function of activation function
- 数据库-当前读与快照读
- 模拟卷Leetcode【普通】1109. 航班预订统计
- win10无法操作(删除、剪切)文件
- ICLR 2022 spotlight | analog transformer: time series anomaly detection method based on correlation difference
- Web界面元素的测试
猜你喜欢

Manhattan distance and Manhattan rectangle - print back font matrix

E - 食物链

[no app push general test plan

Database isolation level

Left matching principle of joint index

Basic knowledge of error

10M25DCF484C8G(FPGA) AMY-6M-0002 BGA GPS模块

【Postman】测试(Tests)脚本编写和断言详解

Construction and integration of Zipkin and sleuth for call chain monitoring

D - How Many Answers Are Wrong
随机推荐
(中)苹果有开源,但又怎样呢?
What are the test sites for tunnel engineering?
Postman核心功能解析-参数化和测试报告
Construction and integration of Zipkin and sleuth for call chain monitoring
Pat (Grade B) 2022 summer exam
RestTemplate、Feign实现Token传递
[no app push general test plan
【Postman】Collections-运行配置之导入数据文件
Simulation volume leetcode [general] 1062 Longest repeating substring
Embedded point test of app
Simulation volume leetcode [general] 1249 Remove invalid parentheses
Thoughts on data security (Reprint)
调用链监控Zipkin、sleuth搭建与整合
sourceInsight中文乱码
How to extract login cookies when JMeter performs interface testing
Full link voltage measurement: building three models
10m25dcf484c8g (FPGA) amy-6m-0002 BGA GPS module
Customize the gateway filter factory on the specified route
P问题、NP问题、NPC问题、NP-hard问题详解
把el-tree选中的数组转换为数组对象