VS2015 现在错误 C4477 “fprintf" [英] VS2015 now error C4477 "fprintf"
问题描述
到目前为止,VS 完美地编译了我的代码,但现在 VS2015 向我显示了一个我无法理解的警告.
Until now, VS compile my code perfectly, but now VS2015 show me a warning that I can't to understand.
我的代码:
CString nombre=_T("Stack"), dsc=_T("overflow");
_ftprintf(file, _T("%s %s);\n"), nombre, m_dsc);
和 VS2015:
警告 C4477 'fwprintf' : 格式字符串 '%s' 需要一个参数类型 'wchar_t *',但可变参数 1 的类型为 'CString'
Warning C4477 'fwprintf' : format string '%s' requires an argument of type 'wchar_t *', but variadic argument 1 has type 'CString'
为什么?,为什么我不能使用 CString 而不是 wchart_t?.我想使用 CString
Why?, Why can't I use CString instead of wchart_t?. I want to use CString
非常感谢
何塞米
推荐答案
我更喜欢 GetString() 而不是 C 风格的转换:
I preffer GetString() instead of C-style casting:
_ftprintf(file, _T("%s %s);\n"), nombre.GetString(), dsc.GetString());
我建议考虑使用 std::fstream 来处理文本文件.
And I recommend to consider to use std::fstream's to work with text files.
这篇关于VS2015 现在错误 C4477 “fprintf"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!