My main has the following signature:
int _tmain(int argc, _TCHAR* argv[])
I would like to preform the following:
FILE *inputFilePtr;
inputFilePtr = fopen(argv[2], "_r");
But there is a type mismatch. How should I do it? Should I use:
inputFilePtr = _tfopen(argv[2], ??????);
Thanks!
Use:
_tfopen(argv[2], TEXT("r"));
Do not use:
_tfopen(argv[2], L"r");
The second one will give compilation error if the macro UNICODE
is not defined, that is, when TCHAR
is just char
, not wchar_t
.
Use _tfopen(argv[2], TEXT("r"));
or _tfopen(argv[2], L"r");
if TCHAR is WCHAR.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.