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. C / C++ / MFC
  4. CTime causes exceptions

CTime causes exceptions

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 Posts 3 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.
  • D Offline
    D Offline
    Daniel1324
    wrote on last edited by
    #1

    A call to any CTime member function causes unhandled exceptions, access violation. Any ideas why?

    D 1 Reply Last reply
    0
    • D Daniel1324

      A call to any CTime member function causes unhandled exceptions, access violation. Any ideas why?

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Daniel1324 wrote: Any ideas why? Not without a code snippet that exhibits the problem.


      Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

      D 1 Reply Last reply
      0
      • D David Crow

        Daniel1324 wrote: Any ideas why? Not without a code snippet that exhibits the problem.


        Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

        D Offline
        D Offline
        Daniel1324
        wrote on last edited by
        #3

        CTime t; t.GetYear();

        J D 2 Replies Last reply
        0
        • D Daniel1324

          CTime t; t.GetYear();

          J Offline
          J Offline
          JohnJ
          wrote on last edited by
          #4

          Daniel1324 wrote: CTime t; t.GetYear(); What year would that be then?:sigh: t is unitialised and has no valid data so it goes crash bang wallop when you try to use it:doh: See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_ctime.3a3a.ctime.asp[^] John Hudson Megan Forbes after having cage slightly rattled: Grrrrrrr....:baaaa!: humbug I say!:omg: JohnJ makes a note to wear protective clothing/goggles next time;P http://www.rainbow-innov.co.uk[^]

          1 Reply Last reply
          0
          • D Daniel1324

            CTime t; t.GetYear();

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            I'm curious what you expected to come from an uninitialized object? Even though CTime::GetYear() is dereferencing a NULL pointer, it doesn't make sense that you'd assume valid data would be returned.


            Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

            D 1 Reply Last reply
            0
            • D David Crow

              I'm curious what you expected to come from an uninitialized object? Even though CTime::GetYear() is dereferencing a NULL pointer, it doesn't make sense that you'd assume valid data would be returned.


              Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

              D Offline
              D Offline
              Daniel1324
              wrote on last edited by
              #6

              My fault. I was assuming that it would return date and time stored in the system.

              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