回答
他们工作在不同的字符类型:
std::cout
使用char
为字符类型std::wcout
使用wchar_t
为字符类型
否则两个流写到标准输出。
但什么是宽字符任何方式? –
'char'用于*窄*字符串,适用于7位ASCII和8位ANSI。 'wchar_t'用于* wide *字符串,也就是Unicode字符串。然而,'wchar_t'的大小是不可移植的,在某些系统上它是16位(适用于UCS2/UTF-16),其他系统则是32位(适用于UCS4/UTF-32)。 C++ 11引入了新的'char16_t'和'char32_t'类型来解决这个问题。 –
另一件事是,两者都与尊重输入流一起使用。
这些对象在第一次创建对象std::ios_base::Init
期间或之前被初始化。
std::cout
是std::basic_ios::tie
倒是到std::cin
并std::cerr
std:wcout
是std::basic_ios::tie
倒是到std::wcin
并std::wcerr
@Galik当然。感谢您的纠正。抱歉回复晚了。 – oguzhanunlu
- 1. std :: transform和std :: for_each有什么区别?
- 2. std :: function和std :: mem_fn有什么区别
- 3. std :: invoke和std :: function有什么区别?
- 4. std :: set和std :: vector有什么区别?
- 5. std :: merge和std :: set_union有什么区别?
- 6. std :: partial_sum和std :: inclusive_scan有什么区别?
- 7. “UTF-16”和“std :: wstring”有什么区别?
- 8. std :: deque和boost:deque有什么区别?
- 9. std :: move和unique_ptr :: reset有什么区别?
- 10. lambda和std :: function有什么区别?
- 11. std :: cout << x;和std :: cout << x << std :: endl;?
- 12. setbase(8)和std :: cout << std :: oct
- 13. std :: string :: c_str和std :: string :: data有什么区别?
- 14. C++ std :: lock和std :: unique_lock之间有什么区别?
- 15. std :: to_string,boost :: to_string和boost :: lexical_cast <std::string>有什么区别?
- 16. std :: strtol和std :: stoi之间有什么区别?
- 17. std :: condition_variable和std :: condition_variable_any之间有什么区别?
- 18. -std = C++ 11和-std = gnu ++ 11之间有什么区别?
- 19. std :: chrono和cout
- 20. std :: endl与cout和wcout一起工作吗?
- 21. C++中的空std :: shared_ptr与空std :: shared_ptr有什么区别?
- 22. 什么是std :: cout << std :: cin做什么?
- 23. 为什么我们需要绑定std :: cin和std :: cout?
- 24. 澄清使用std ::,std :: cout
- 25. xcode std :: wcout用wchar_t或std :: wstring!
- 26. std :: logical_not和std :: not1之间的区别?
- 27. std :: is_integer和std :: is_integral之间的区别?
- 28. std :: regex_match和std :: regex_search之间的区别?
- 29. C++中std :: unique_ptr和std :: shared_ptr的区别
- 30. std :: uninitialized_copy和std :: copy之间的区别?
标准流的瓦特版本为** **瓦特IDE字符。 – NathanOliver