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. Unhandled Exception errror in CStringData GetData()

Unhandled Exception errror in CStringData GetData()

Scheduled Pinned Locked Moved C / C++ / MFC
help
5 Posts 4 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.
  • A Offline
    A Offline
    Anu_Bala
    wrote on last edited by
    #1

    In my function, Im assignning one Global CString to varaible declared in header file.But it shows unhandled exception error. My code

    CString sReceiceStr = _T(""); //Global variable

    void CChatServerDlg::AddMsg( userinfo \*udata, CString sIP)
    {
    	
    sReceiceStr.Format("%s : %s  : %s : %s : %s",udata->cSessionID ,udata->cTraineeName, udata->cPassword, udata->cClientServerMsg, udata->cInsName);
    
    		
    sTempassign = sReceiceStr;   //sTempassign is declared in Headerfile of this dlg class
    

    It shows error in the above line. It shows error in CStringData GetData() function Kindly help me.

    Anu

    _ D 2 Replies Last reply
    0
    • A Anu_Bala

      In my function, Im assignning one Global CString to varaible declared in header file.But it shows unhandled exception error. My code

      CString sReceiceStr = _T(""); //Global variable

      void CChatServerDlg::AddMsg( userinfo \*udata, CString sIP)
      {
      	
      sReceiceStr.Format("%s : %s  : %s : %s : %s",udata->cSessionID ,udata->cTraineeName, udata->cPassword, udata->cClientServerMsg, udata->cInsName);
      
      		
      sTempassign = sReceiceStr;   //sTempassign is declared in Headerfile of this dlg class
      

      It shows error in the above line. It shows error in CStringData GetData() function Kindly help me.

      Anu

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      Runtime exception or compile error? You could try to use the _T macro for the format string - _T("%s : %s : %s : %s : %s")

      «_Superman_»  _I love work. It gives me something to do between weekends.

      _Microsoft MVP (Visual C++)

      Polymorphism in C

      A 1 Reply Last reply
      0
      • _ _Superman_

        Runtime exception or compile error? You could try to use the _T macro for the format string - _T("%s : %s : %s : %s : %s")

        «_Superman_»  _I love work. It gives me something to do between weekends.

        _Microsoft MVP (Visual C++)

        Polymorphism in C

        A Offline
        A Offline
        Anu_Bala
        wrote on last edited by
        #3

        Run Time error only. But when i cahnge the calling method og AddMsg,no error is coming. May be it smy mistake.Now its working.

        Anu

        T 1 Reply Last reply
        0
        • A Anu_Bala

          Run Time error only. But when i cahnge the calling method og AddMsg,no error is coming. May be it smy mistake.Now its working.

          Anu

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

          have you check the string formation of variable after string.format ? try using watch

          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
          Never mind - my own stupidity is the source of every "problem" - Mixture

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

          1 Reply Last reply
          0
          • A Anu_Bala

            In my function, Im assignning one Global CString to varaible declared in header file.But it shows unhandled exception error. My code

            CString sReceiceStr = _T(""); //Global variable

            void CChatServerDlg::AddMsg( userinfo \*udata, CString sIP)
            {
            	
            sReceiceStr.Format("%s : %s  : %s : %s : %s",udata->cSessionID ,udata->cTraineeName, udata->cPassword, udata->cClientServerMsg, udata->cInsName);
            
            		
            sTempassign = sReceiceStr;   //sTempassign is declared in Headerfile of this dlg class
            

            It shows error in the above line. It shows error in CStringData GetData() function Kindly help me.

            Anu

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

            Is udata non-NULL? Have you stepped into Format() to see what throws the exception?

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

            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