strcpy_s和StringCchCopy [英] strcpy_s vs StringCchCopy

查看:85
本文介绍了strcpy_s和StringCchCopy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的大师,

任何人都可以解释strcpy_sStringCchCopy之间的区别吗?

我也想知道StrSafe.h中找到的函数与其他安全字符串函数(例如wcscpy_s等)之间的区别.

请建议最好使用哪个功能.

在此先谢谢您.

Dear Gurus,

Can anyone please explain the difference between strcpy_s and StringCchCopy?

I would also like to know the difference between the functions found in StrSafe.h and the other safe string functions like wcscpy_s etc.

Please advice which function is best to use.

Thanks in advance.

推荐答案

如果您真的想使用安全的"密码(它们并不是很安全,而且速度很慢),我会同意的. strcpy_s.它是随CRT提供的,而StringCchCopy取决于Windows版本-仅在XP SP2及更高版本中受支持.
If you really want to use the "safe" ones (they are not really safe, and are slow), I''d go with strcpy_s. It is provided with CRT, whereas StringCchCopy depends on Windows version - it is supported only in XP SP2 and above.


它们都具有相同的作用. strcpy_s是标准C,另一个是 MFC 本机Windows API.

Google确实有效.试试这个链接:

http://msdn.microsoft.com/en-us/library/ms646979 (v = VS.85).aspx [
They both do the same thing. strcpy_s is standard C, and the other is MFC a native Windows API.

Google really does work. Try this link:

http://msdn.microsoft.com/en-us/library/ms646979(v=VS.85).aspx[^]


两个版本均为"Sercure".
我个人更喜欢"StringCchCopy"版本,因为它们比* _S版本更干净,更一致.

问候,

K,D
Both Versions are "Sercure".
I personally prefer the "StringCchCopy" versions since they are cleaner and more consistent then the *_S versions.

Regards,

K,D


这篇关于strcpy_s和StringCchCopy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆