Predefined MACROs are not Implemented yet.

I

Immortal Nephi

I examine some websites to look for predefined macros. __FILE__,
__DATE__, and __TIME__ are reserved by C/C++ Compiler. If you try to
convert them to Unicode, they are not yet implemented or they are
undefined.

#define _WIDEN2( x ) L ## x
#define _WIDEN( x ) _WIDEN2( x )
#define __WFILE__ _WIDEN( __FILE__ )
#define __WDATE__ _WIDEN( __DATE__ )
#define __WTIME__ _WIDEN( __TIME__ )

You cannot define __WFILE__, __WDATE__, and __WTIME__ because they
might be reserved and added to C/C++ Compiler in the future.
I thought that you accept alternative solution.

const std::wstring WIDEN( const char* Text )
{
std::wostringstream woss;
woss << Text;

return woss.str();
}

int main()
{
std::wstring WFILE = WIDEN( __FILE__ );
std::wcout << "File: " << WFILE << std::endl;

return 0;
}

Please let me know what you are saying your opinion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top