Predefined MACROs are not Implemented yet.

Discussion in 'C++' started by Immortal Nephi, Feb 27, 2010.

  1. 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.
    Immortal Nephi, Feb 27, 2010
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sascha Folville
    Replies:
    0
    Views:
    636
    Sascha Folville
    Dec 18, 2003
  2. Roy Smith

    How to signal "not implemented yet"?

    Roy Smith, Dec 26, 2005, in forum: Python
    Replies:
    3
    Views:
    395
    Roy Smith
    Dec 26, 2005
  3. sathya_me

    C predefined macros and portability

    sathya_me, Aug 18, 2004, in forum: C Programming
    Replies:
    5
    Views:
    1,496
    Goran Larsson
    Aug 18, 2004
  4. Berehem
    Replies:
    4
    Views:
    541
    Lawrence Kirby
    Apr 28, 2005
  5. Pedro Graca

    Functions implemented as macros?

    Pedro Graca, Jan 19, 2008, in forum: C Programming
    Replies:
    5
    Views:
    282
    James Kuyper
    Jan 20, 2008
Loading...

Share This Page