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. The Lounge
  3. Strings to Variable Names

Strings to Variable Names

Scheduled Pinned Locked Moved The Lounge
questiondata-structurescollaborationtutorial
5 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.
  • J Offline
    J Offline
    James A Beggs
    wrote on last edited by
    #1

    I am a professional, but unfortunately junior, developer, and I'm looking to do something that I thought I knew how to do. Now, I cannot recall how to do it, and I'm feeling... well, terribly ignorant. What is going on is I want to create an array of arrays - in specific, I'm making a pointer of pointers, actually. I want each of the pointers in the "array" to point at an object of the same type. I wanted to set up a for-loop to assign these. In other words, I have something like: TCSpinEdit ** SpinnerArray; SpinnerArray = new TCSpinEdit *[58]; for (int iCtr = 0; iCtr < 58; iCtr++) the name of each of these objects starts out with CSpin followed by a number, from 1 to 58; so I need to point to CSpin1, then CSpin2, etc. Therefore, I need to generate a string, or whathave you, to designate each CSpin variable to each of the pointes in the array. And I realized I was unsure how to go about this. :) I started originally by using the string class; assign it as: string = "Cspin" + iCtr; But I realized I wasn't sure how to use the string to refer to a variable NAME. Any suggestions? Thanks! James A Beggs Microsoft MSN Mobile Component Test Team

    J 1 Reply Last reply
    0
    • J James A Beggs

      I am a professional, but unfortunately junior, developer, and I'm looking to do something that I thought I knew how to do. Now, I cannot recall how to do it, and I'm feeling... well, terribly ignorant. What is going on is I want to create an array of arrays - in specific, I'm making a pointer of pointers, actually. I want each of the pointers in the "array" to point at an object of the same type. I wanted to set up a for-loop to assign these. In other words, I have something like: TCSpinEdit ** SpinnerArray; SpinnerArray = new TCSpinEdit *[58]; for (int iCtr = 0; iCtr < 58; iCtr++) the name of each of these objects starts out with CSpin followed by a number, from 1 to 58; so I need to point to CSpin1, then CSpin2, etc. Therefore, I need to generate a string, or whathave you, to designate each CSpin variable to each of the pointes in the array. And I realized I was unsure how to go about this. :) I started originally by using the string class; assign it as: string = "Cspin" + iCtr; But I realized I wasn't sure how to use the string to refer to a variable NAME. Any suggestions? Thanks! James A Beggs Microsoft MSN Mobile Component Test Team

      J Offline
      J Offline
      Jon Sagara
      wrote on last edited by
      #2

      Please ask programming questions in the programming forums. Visual C++ Forum[^] Jon Sagara I have no complaint with the “mentoring concept” or the marriage concept or the sex concept. But if you pay for any of those, something’s wrong. -- John T. Reed in The real estate B.S. artist detection checklist [^]

      J 2 Replies Last reply
      0
      • J Jon Sagara

        Please ask programming questions in the programming forums. Visual C++ Forum[^] Jon Sagara I have no complaint with the “mentoring concept” or the marriage concept or the sex concept. But if you pay for any of those, something’s wrong. -- John T. Reed in The real estate B.S. artist detection checklist [^]

        J Offline
        J Offline
        James A Beggs
        wrote on last edited by
        #3

        er, sorry. :) James A Beggs Microsoft MSN Mobile Component Test Team

        1 Reply Last reply
        0
        • J Jon Sagara

          Please ask programming questions in the programming forums. Visual C++ Forum[^] Jon Sagara I have no complaint with the “mentoring concept” or the marriage concept or the sex concept. But if you pay for any of those, something’s wrong. -- John T. Reed in The real estate B.S. artist detection checklist [^]

          J Offline
          J Offline
          James A Beggs
          wrote on last edited by
          #4

          er, sorry. :) although it wasnt really for Visual C++; I'm using it in Borland C++ builder, but ok. James A Beggs Microsoft MSN Mobile Component Test Team

          J 1 Reply Last reply
          0
          • J James A Beggs

            er, sorry. :) although it wasnt really for Visual C++; I'm using it in Borland C++ builder, but ok. James A Beggs Microsoft MSN Mobile Component Test Team

            J Offline
            J Offline
            Jon Sagara
            wrote on last edited by
            #5

            That just happens to be the unfortunate title of the C++ forum. Jon Sagara I have no complaint with the “mentoring concept” or the marriage concept or the sex concept. But if you pay for any of those, something’s wrong. -- John T. Reed in The real estate B.S. artist detection checklist [^]

            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