Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. cannot get text of __DATE__ (resolved)

cannot get text of __DATE__ (resolved)

Scheduled Pinned Locked Moved ATL / WTL / STL
c++csharpvisual-studiocomquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bkelly13
    wrote on last edited by
    #1

    Visual Studio 2008, C++, MFC

    lang="cs">
    const char build_date[] = __DATE__;
    swprintf_s( my_date, my_size, L"%s", build_date );
    swprintf_s( my_date, my_size, L"%ls, build_date );
    show_date.SetWindowTextW( my_date );

    show_date.SetWindowText( __DATE__
    show_date.SetWindowText( L"this displays" );

    String my_date does not contain the date that is found in build_date. Multiple versions have been tried and not successful in getting compile date to display in the dialog. All the searches I have done tell me this should work. What must be changed?

    Thank you for your time If you work with telemetry, please check this bulletin board: www.irigbb.com

    L 1 Reply Last reply
    0
    • B bkelly13

      Visual Studio 2008, C++, MFC

      lang="cs">
      const char build_date[] = __DATE__;
      swprintf_s( my_date, my_size, L"%s", build_date );
      swprintf_s( my_date, my_size, L"%ls, build_date );
      show_date.SetWindowTextW( my_date );

      show_date.SetWindowText( __DATE__
      show_date.SetWindowText( L"this displays" );

      String my_date does not contain the date that is found in build_date. Multiple versions have been tried and not successful in getting compile date to display in the dialog. All the searches I have done tell me this should work. What must be changed?

      Thank you for your time If you work with telemetry, please check this bulletin board: www.irigbb.com

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You are using the wide character version of swprintf_s, but your date string is char type, so you need to use the upper case S in your format string so it gets converted to Unicode, thus:

      swprintf_s( my_date, my_size, L"%S", build_date );

      B 1 Reply Last reply
      0
      • L Lost User

        You are using the wide character version of swprintf_s, but your date string is char type, so you need to use the upper case S in your format string so it gets converted to Unicode, thus:

        swprintf_s( my_date, my_size, L"%S", build_date );

        B Offline
        B Offline
        bkelly13
        wrote on last edited by
        #3

        That was it. Thank you.

        Thank you for your time If you work with telemetry, please check this bulletin board: www.irigbb.com

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups