std::wcout.STL

来源:互联网 发布:linux ssh端口22修改 编辑:程序博客网 时间:2024/06/03 23:40

 1.输出中文

xx.h

  1. #ifdef NOTANSI
  2.     typedef std::wstring token_t;
  3.     #define TOKEN L
  4.     #define CONST_TEXT(x) L##x
  5.     #define gcout std::wcout
  6. #else
  7.     typedef std::string token_t;
  8.     #define TOKEN
  9.     #define CONST_TEXT(x) x
  10.     #define gcout std::cout
  11. #endif

xx.cpp

 

  1. #ifdef NOTANSI
  2.     std::locale gloc("Chinese-simplified");
  3.     struct xcout{
  4.         xcout(){gcout.imbue(gloc);}
  5.     }aXCOUT;
  6. #endif

stdafx.h

  1. #define NOTANSI