加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – Microsoft _stprintf警告

发布时间:2020-12-16 04:51:54 所属栏目:百科 来源:网络整理
导读:为什么我得到以下代码的以下警告:) 码: _stprintf(m_szFileNamePath,_T("%s"),strFileName); warning C4996: ‘_swprintf’: swprintf has been changed to conform with the ISO C standard,adding an extra character count parameter. To use traditiona
为什么我得到以下代码的以下警告:)

码:

_stprintf(m_szFileNamePath,_T("%s"),strFileName);

warning C4996: ‘_swprintf’: swprintf has been changed to conform with the ISO C standard,adding an extra character count parameter. To use traditional Microsoft swprintf,set _CRT_NON_CONFORMING_SWPRINTFS.

我知道_strprintf是一个宏,如果定义_UNICODE将评估为_swprintf,否则它将是sprintf.

现在这是什么_swprintf.有一个函数swprintf,但为什么_stprintf评估为_swprintf而不是swprintf.

b / w _xxx和xxx有什么区别?

编辑:

好的,_stprintf的UNICODE版本有两个定义,其中一个包含在内?

tchar.h或strsafe.h中的那个?

解决方法

http://msdn.microsoft.com/en-us/library/ybk95axf%28VS.80%29.aspx

swprintf is a wide-character version of sprintf; the pointer arguments to swprintf are wide-character strings. Detection of encoding errors in swprintf may differ from that in sprintf. swprintf and fwprintf behave identically except that swprintf writes output to a string rather than to a destination of type FILE,and swprintf requires the count parameter to specify the maximum number of characters to be written. The versions of these functions with the _l suffix are identical except that they use the locale parameter passed in instead of the current thread locale.

In Visual C++ 2005,swprintf conforms to the ISO C Standard,which requires the second parameter,count,of type size_t. To force the old nonstandard behavior,define _CRT_NON_CONFORMING_SWPRINTFS. In a future version,the old behavior may be removed,so code should be changed to use the new conformant behavior.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读