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. CString pointers

CString pointers

Scheduled Pinned Locked Moved C / C++ / MFC
questiondiscussion
6 Posts 5 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.
  • E Offline
    E Offline
    elephantstar
    wrote on last edited by
    #1

    I need to pass dereference a pointer so that I can obtain a CString. It seems to crash on the second function call. I think I'm not handling the deletion of the pointer correctly? What do you think? Thanks! CString new_date; BOOL new_date; new_date = IsDate("4/5/07", &new_date); int CDateTime::IsDate(CString datestr, CString * new_date_format) { CString month; CString day; CString year; /* parse datestr */ CString revised_str = month + "/" + day + "/" + year; *new_date_format = revised_str; }

    M V J T 4 Replies Last reply
    0
    • E elephantstar

      I need to pass dereference a pointer so that I can obtain a CString. It seems to crash on the second function call. I think I'm not handling the deletion of the pointer correctly? What do you think? Thanks! CString new_date; BOOL new_date; new_date = IsDate("4/5/07", &new_date); int CDateTime::IsDate(CString datestr, CString * new_date_format) { CString month; CString day; CString year; /* parse datestr */ CString revised_str = month + "/" + day + "/" + year; *new_date_format = revised_str; }

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      You have two variables called new_date - typo?

      --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ VB > soccer

      E 1 Reply Last reply
      0
      • M Michael Dunn

        You have two variables called new_date - typo?

        --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ VB > soccer

        E Offline
        E Offline
        elephantstar
        wrote on last edited by
        #3

        Yes. I meant to name it differently.

        1 Reply Last reply
        0
        • E elephantstar

          I need to pass dereference a pointer so that I can obtain a CString. It seems to crash on the second function call. I think I'm not handling the deletion of the pointer correctly? What do you think? Thanks! CString new_date; BOOL new_date; new_date = IsDate("4/5/07", &new_date); int CDateTime::IsDate(CString datestr, CString * new_date_format) { CString month; CString day; CString year; /* parse datestr */ CString revised_str = month + "/" + day + "/" + year; *new_date_format = revised_str; }

          V Offline
          V Offline
          valikac
          wrote on last edited by
          #4

          code good add breakpoints what's second parameter at end function? Kuphryn

          1 Reply Last reply
          0
          • E elephantstar

            I need to pass dereference a pointer so that I can obtain a CString. It seems to crash on the second function call. I think I'm not handling the deletion of the pointer correctly? What do you think? Thanks! CString new_date; BOOL new_date; new_date = IsDate("4/5/07", &new_date); int CDateTime::IsDate(CString datestr, CString * new_date_format) { CString month; CString day; CString year; /* parse datestr */ CString revised_str = month + "/" + day + "/" + year; *new_date_format = revised_str; }

            J Offline
            J Offline
            Jun Du
            wrote on last edited by
            #5

            Is it due to the local scope of revised_str? - It's easier to make than to correct a mistake.

            1 Reply Last reply
            0
            • E elephantstar

              I need to pass dereference a pointer so that I can obtain a CString. It seems to crash on the second function call. I think I'm not handling the deletion of the pointer correctly? What do you think? Thanks! CString new_date; BOOL new_date; new_date = IsDate("4/5/07", &new_date); int CDateTime::IsDate(CString datestr, CString * new_date_format) { CString month; CString day; CString year; /* parse datestr */ CString revised_str = month + "/" + day + "/" + year; *new_date_format = revised_str; }

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #6

              elephantstar wrote:

              CString new_date; BOOL new_date; new_date

              Is this compile successfully.. i doubt

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

              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