如何用C和MinGW连接两个字符串?
如何使用 GCC 在 MinGW 中连接(甚至分配)两个字符串(我猜是 TCHAR 数组)?
StrCatBuff
?#include
和-lshlwapi
可以工作,但您不应该使用它_tcscat
?
似乎不存在StringCchCat
似乎不存在。strsafe.h
不存在。
这同样适用于它们各自的赋值函数,例如 StringCchCpy
和 _tcscpy
。
How do I concatenate (or even assign) two strings (TCHAR
arrays, I guess) in MinGW with GCC?
StrCatBuff
?#include <shlwapi.h>
and-lshlwapi
do work, but you're not supposed to use it_tcscat
?
Seems not to existStringCchCat
Seems not to exist.strsafe.h
doesn't exist.
The same holds true for their respective assignment functions like StringCchCpy
and _tcscpy
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
_tcscat
(或“安全”版本,_tcscat_s
) 对于连接TCHAR
数组来说效果很好。您必须包含tchar.h
才能使用这两个函数。对于
StringCchCat
来说也是如此,正如您提到的,它是在strsafe.h
中定义的。如果您缺少这些头文件,请确保您已安装 Windows SDK。它可能不像 Microsoft 工具那样默认包含在 MinGW 中。
_tcscat
(or the "secure" version,_tcscat_s
) works just fine for concatenating arrays ofTCHAR
s. You have to includetchar.h
in order to use either of these functions.The same should be true for
StringCchCat
, which as you mention is defined instrsafe.h
.If you're missing these header files, make sure that you've installed the Windows SDK. It's probably not included by default with MinGW like it is with Microsoft's tooling.