See link for what I'm talking about.
I want to use point 1 in the link and
#define tfopen _wfopen
#define _T(s) L##s
to do exactly what the link says is possible:
std::ifstream file( tfopen("filename.txt", _T("r") );
But gcc (mingw) 4开发者_如何学JAVA.4 says there's no matching call...
Am I doing it wrong or is the info in the link above incorrect?
You need to use the macro for the first parameter to tfopen, which in your case is "filename.txt"
std::ifstream file( tfopen(_T("filename.txt"), _T("r") );
The simple answer is that you're missing a _T
. However, you may want to rethink the entire TCHAR
approach and just call _wfopen
(assuming Windows-only code).
精彩评论