gpt4 book ai didi

c++ - Linux 上的 tchar.h

转载 作者:IT老高 更新时间:2023-10-28 22:04:58 27 4
gpt4 key购买 nike

我正在尝试编写跨平台 i18n C++ 代码。由于大多数 linux 系统更喜欢使用 UTF-8 作为字符编码,我认为我应该在 linux 上使用 string,在 Windows 上使用 wstring。 tchar.h 在 Linux 上可用吗? Linux 上 tchar.h 的等效替代品是什么?

最佳答案

您可能会发现 this文章有用。特别是,在接近尾声时,他们讨论了一些关于使用 TCHAR 和处理 Windows 代码的问题。

文章总结为:

TCHAR will be translated into a wide character data type when compiling this code with the GNU C Compiler (most portable libraries define TCHAR in their headers and refer to wchar_t). This, in fact, was how I turned my C++ program into an anagram generator: I used standard C++ strings filled with UTF-8 and fed the data with pointers casted to wchar_t to library functions. UTF-8 data interpreted as UTF-32 equals garbage (but it is tremendously useful for obfuscation of data and bugs).

关于c++ - Linux 上的 tchar.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/895804/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com