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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top