如何cout std :: basic_string< TCHAR> [英] How to cout the std::basic_string<TCHAR>

查看:516
本文介绍了如何cout std :: basic_string< TCHAR>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图引导一个 basic_string< TCHAR> 。但cout是抛出的错误。我可以知道如何做

I am trying to cout a basic_string<TCHAR>. But cout is throwing error. Can I know how to do that

推荐答案

正如dauphic所说, std :: wcout 用于宽字符串, std :: cout 用于窄字符串。如果你想要能够编译任何类型的字符串( TCHAR 是为了让这种事情更容易)这样的东西有时使生活更容易:

As dauphic said, std::wcout is for wide strings and std::cout for narrow ones. If you want to be able to compile for either type of string (TCHAR is meant to make this sort of thing easier) something like this sometimes makes life easier:

#if defined(UNICODE) || defined(_UNICODE)
#define tcout std::wcout
#else
#define tcout std::cout
#endif

这里使用tcout。

这篇关于如何cout std :: basic_string&lt; TCHAR&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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