摘要:
在VC2005的CRT中,增加了一些具有更强安全性的CRT函数,例如strcpy_s, strncat_s等。(MSDN: <Security Enhancements in the CRT > Significant enhancements have been made to make the CRT more secure. Many CRT functions now have more secure versions. If a new secure function exists, the older, less secure version is marked as 阅读全文
posted @ 2011-02-17 10:08
oayx
阅读(8728)
评论(0)
推荐(0)
摘要:
看名字明白,它和strcpy()函数的功能应该一样的。strcpy函数,就象gets函数一样,它没有方法来保证有效的缓冲区尺寸,所以它只能假定缓冲足够大来容纳要拷贝的字符串。在程序运行时,这将导致不可预料的行为。用strcpy_s就可以避免这些不可预料的行为。这个函数用两个参数、三个参数都可以,只要可以保证缓冲区大小。三个参数时:errno_t strcpy_s( char *strDestination, size_t numberOfElements, const char *strSource );两个参数时:errno_t strcpy_s( char (&strDestina 阅读全文
posted @ 2011-02-17 10:03
oayx
阅读(21705)
评论(0)
推荐(0)

浙公网安备 33010602011771号