CString类型直接相加出错

本文探讨了使用CString进行字符串拼接时遇到的一个特殊问题:当CString与其他字符串直接相加时,可能会出现意料之外的结果。文章通过一个具体示例说明了如何通过调用ReleaseBuffer()方法来解决这个问题。

一般来说我们用CString 直接相加,没什么问题。

但今天用CString cstrTemp;

GetPrivateProfileString("AA","BB",cstrPath, cstrTmp.GetBuffer(MAX_PATH),MAX_PATH,cstrFile);

CstrTemp+="\\*.*";

得到的值是\.*

加上,cstrTmp.ReleaseBuffer();问题解决


dllPath = 'D:\CV_study\C++\MyDll2\x64\Debug\MathLib.dll'; headerPath = 'D:\CV_study\C++\MyDll2\MathLib.h'; % 加载DLL [notfound, warnings] = loadlibrary(dllPath, headerPath); % 检查是否加载成功 if libisloaded('MathLib') disp('DLL加载成功'); else error('DLL加载失败'); end 报错: 加载随后的库中间输出时出错。 实际错误位于此输出末尾。 ********* Locale 'Chinese (Simplified)_China.936' is unsupported, and may crash the interpreter. Working string is 'extern " C " { int __stdcall AddTwoNumbers ( int a , int b ); }'. at D:\soft\MATLAB2024\toolbox\matlab\general\private\prototypes.pl line 1099, <INFILE> line 14. main::DumpError("extern \"C\" { found in file. C++ files are not supported. Use"...) called at D:\soft\MATLAB2024\toolbox\matlab\general\private\prototypes.pl line 312 ERROR: extern "C" { found in file. C++ files are not supported. Use #ifdef __cplusplus to protect. Found on line 14 of input from line 13 of file D:\\CV_study\\C++\\MyDll2\\MathLib.h ********* 错误使用 loadlibrary 调用 Perl 失败。处理头文件时可能出错。 Perl 命令输出: Locale 'Chinese (Simplified)_China.936' is unsupported, and may crash the interpreter. Working string is 'extern " C " { int __stdcall AddTwoNumbers ( int a , int b ); }'. at D:\soft\MATLAB2024\toolbox\matlab\general\private\prototypes.pl line 1099, <INFILE> line 14. main::DumpError("extern \"C\" { found in file. C++ files are not supported. Use"...) called at D:\soft\MATLAB2024\toolbox\matlab\general\private\prototypes.pl line 312 ERROR: extern "C" { found in file. C++ files are not supported. Use #ifdef __cplusplus to protect. Found on line 14 of input from line 13 of file D:\\CV_study\\C++\\MyDll2\\MathLib.h 出错 test (第 9 行) [notfound, warnings] = loadlibrary(dllPath, headerPath); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11-05
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值