Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的主要有以下签名:
int _tmain(int argc, _TCHAR* argv[])
我想执行以下操作:
FILE *inputFilePtr; inputFilePtr = fopen(argv[2], "_r");
但是存在类型不匹配。我该怎么做?我应该使用:
inputFilePtr = _tfopen(argv[2], ??????);
谢谢!
利用:
_tfopen(argv[2], TEXT("r"));
不使用:
_tfopen(argv[2], L"r");
第二个如果UNICODE没有定义宏会报编译错误,即when TCHARis just char, not wchar_t。
UNICODE
TCHAR
char
wchar_t
利用 _tfopen(argv[2], TEXT("r"));
或者_tfopen(argv[2], L"r");如果 TCHAR 是 WCHAR。