Generic Macro for UNICODE and ANSI
来源:互联网 发布:淘宝号怎么买 编辑:程序博客网 时间:2024/04/29 06:11
经常会看到windows程序里在字符串前面加上_T, L, _TEXT等等宏,实际上就是针对16bit unicode和8bit ansi的指示符。_T = TEXT = _TEXT
"8 bit characters"
L("16 bit characters")
_T("generic characters")
Windows根据当前UNICODE是否定义来判断通用的宏对应WCHAR还是CHAR。
#ifdef UNICODE
#define TCHAR WCHAR
#else
#define TCHAR CHAR
#endif
对指向字符串的指针也有通用的宏。
LPTSTR
LPCTSTR (指向常量字符串)
如果要使用这些通用的宏,需要#include <windows.h>与 #include <tchar.h>。当使用Visual Studio 2003.NET创建C++ console工程,会出现_tmain作为入口的程序。而 _t 表示使用对unicode与ansi通用的函数。包含了<tchar.h>的工程,main()与tmain()都可以作为入口函数
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
"stdafx.h"中则定义了
#pragma once
#include <iostream>
#include <tchar.h>
实际上就是包含了<tchar.h>
- Generic Macro for UNICODE and ANSI
- Unicode and ANSI
- Unicode and ANSI
- Chapter 7Iterators and the Generic for
- ANSI ---> UNICODE
- ANSI,UNICODE
- strange c define for macro and array(c语言)
- ANSI(字符集) and Unicode(字符集) and UTF-8(编码Unicode字符集)
- LUA学习笔记2-Iterators and the Generic for
- UNICODE to ANSI 和 ANSI to UNICODE
- Ansi转Unicode,Unicode转Ansi
- Set&Get and MACRO
- the macro # and ## (typing...)
- linux : macro for syslog
- Unicode vs Ansi
- Unicode vs Ansi
- ANSI vs UNICODE
- Unicode vs Ansi
- 生活
- XVID技术
- 模式的组合
- 被称为世上最经典的14句话
- linux命令之文件的复制(CP) [转载]
- Generic Macro for UNICODE and ANSI
- 得到磁盘剩余空间
- 华硕A4530D-DR笔记本
- 免费电子书资源1
- VS2003下面编译log4cpp-0.3.5rc2手记
- 你见过三元人民币吗?
- 开发程序
- 如何找到指定时间段内的所有文件
- 第一次使用csdn blog