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. How to add strings in CStringArray object?

How to add strings in CStringArray object?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
9 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.
  • A Offline
    A Offline
    Atul23
    wrote on last edited by
    #1

    Hi All, I am using CStringArray object for adding number of strings in it. I used following code m_HTML_Page_arry->SetAt(i,strPagePath); where m_HTML_page_arry is declared as CStringArray *m_HTML_page_arry in .h file of this class. I got assertion on the above code. So if anybody have solution to this then plz forward it to me. Atul

    N D 2 Replies Last reply
    0
    • A Atul23

      Hi All, I am using CStringArray object for adding number of strings in it. I used following code m_HTML_Page_arry->SetAt(i,strPagePath); where m_HTML_page_arry is declared as CStringArray *m_HTML_page_arry in .h file of this class. I got assertion on the above code. So if anybody have solution to this then plz forward it to me. Atul

      N Offline
      N Offline
      Nishad S
      wrote on last edited by
      #2

      Use Add

      - NS -

      A 1 Reply Last reply
      0
      • N Nishad S

        Use Add

        - NS -

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

        Hi I use Add as following way, though there is Assertion, what is the problem in this code. m_HTML_Page_arry->Add(strPagePath); Thanks in Advance Atul

        C 1 Reply Last reply
        0
        • A Atul23

          Hi I use Add as following way, though there is Assertion, what is the problem in this code. m_HTML_Page_arry->Add(strPagePath); Thanks in Advance Atul

          C Offline
          C Offline
          chandu004
          wrote on last edited by
          #4

          have you allocated memory for this? m_HTML_Page_arry

          Suggestion to the members: prefix your main thread subject with [SOLVED] if it is solved. chandu.

          A 1 Reply Last reply
          0
          • C chandu004

            have you allocated memory for this? m_HTML_Page_arry

            Suggestion to the members: prefix your main thread subject with [SOLVED] if it is solved. chandu.

            A Offline
            A Offline
            Atul23
            wrote on last edited by
            #5

            Hi Chandu, I did not allocate memory to m_HTML_Page_arry object. I used it directly. So can I allocate memory to it. Thanks in advance Atul

            C 1 Reply Last reply
            0
            • A Atul23

              Hi Chandu, I did not allocate memory to m_HTML_Page_arry object. I used it directly. So can I allocate memory to it. Thanks in advance Atul

              C Offline
              C Offline
              chandu004
              wrote on last edited by
              #6

              allocate it and see.

              Suggestion to the members: prefix your main thread subject with [SOLVED] if it is solved. chandu.

              1 Reply Last reply
              0
              • A Atul23

                Hi All, I am using CStringArray object for adding number of strings in it. I used following code m_HTML_Page_arry->SetAt(i,strPagePath); where m_HTML_page_arry is declared as CStringArray *m_HTML_page_arry in .h file of this class. I got assertion on the above code. So if anybody have solution to this then plz forward it to me. Atul

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

                Do you have something akin to:

                m_HTML_Page_arry = new CStringArray;

                Why are you not just using an actual object rather than a pointer to one? Most of the time, this indicates a design flaw.


                "A good athlete is the result of a good and worthy opponent." - David Crow

                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                A 1 Reply Last reply
                0
                • D David Crow

                  Do you have something akin to:

                  m_HTML_Page_arry = new CStringArray;

                  Why are you not just using an actual object rather than a pointer to one? Most of the time, this indicates a design flaw.


                  "A good athlete is the result of a good and worthy opponent." - David Crow

                  "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                  A Offline
                  A Offline
                  Atul23
                  wrote on last edited by
                  #8

                  Hi David, Thank u very much.. problem gets solved Atul

                  H 1 Reply Last reply
                  0
                  • A Atul23

                    Hi David, Thank u very much.. problem gets solved Atul

                    H Offline
                    H Offline
                    Hamid Taebi
                    wrote on last edited by
                    #9

                    And in the end remember you must delete this object.

                    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