How do I convert from _TCHAR * to char * when using C++ variable-length args?

前端 未结 4 1428
情话喂你
情话喂你 2021-01-12 05:53

We need to pass a format _TCHAR * string, and a number of char * strings into a function with variable-length args:

inline void FooBar(const _TCHAR *szFmt,          


        
4条回答
  •  无人共我
    2021-01-12 06:27

    Usually it looks like the following:

    char *foo = "foo";
    char *bar = "bar";
    #ifdef UNICODE
    LogToFileW( L"Test %S %S", foo, bar); // big S
    #else
    LogToFileA( "Test %s %s", foo, bar);
    #endif
    

    Your question is not completely clear. How your function is implemented and how do you use it?

提交回复
热议问题