#include <atlconv.h> // Defines the constructs used below
USES_CONVERSION; // Always required when using the macro below (or any of
its cousins)
const wchar_t *pFile = A2CW(__FILE__); // Creates a copy of its (ASCII)
arg in wide-character format and returns a pointer to it
"Vladimir Cherepanov" <nospam> wrote in message
news:u73mnNw...@cppssbbsa02.microsoft.com...
#define XX(st ) L##str
#define X(str) XX(str)
int main()
{
wcout << X(__FILE__) << endl;
return 0;
}
Vladimir
"Andreas Tuerk" <g...@to.hell> wrote in message
news:#dkZOKyWAHA.261@cppssbbsa04...
> What does ## mean?
>
> "vlad" <vl...@topproducer.com> schrieb im Newsbeitrag
> news:eypL4WxWAHA.251@cppssbbsa03...
But __FILE__ is a compiler defined macro that simply expands to a string literal
and it is always of type char*, regardless of whether UNICODE is defined. Since
__FILE__ is just a string literal you can use a macro with a ## operator like
somebody else showed.
Bart.
Your right, the macro is the better (faster) choice for a string literal
like this. However, unless there's some pressing need for wide characters
(not likely), he should really be using _T(__FILE__) which is what I
originally alluded to:
const TCHAR *pFile = _T(__FILE__);