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. Using array of string values

Using array of string values

Scheduled Pinned Locked Moved C / C++ / MFC
c++questiondata-structureshelp
6 Posts 6 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
    Donguy1976
    wrote on last edited by
    #1

    Hello there I am working on a C++ MFC app that has a user login option and the software will store upto 15 passwords used by a user. Now i want to store each password used by a user in a string array and make sure that the user doesn't use an old password when updating the password. i.e., password once used cannot be re-used and an existing password will expire after a set number of days. The question is what kind of collection class i need to use for efficient management of old passwords? CArray?CList? CString array? Any sample code will help. Thanks in advance.

    S J D CPalliniC F 5 Replies Last reply
    0
    • D Donguy1976

      Hello there I am working on a C++ MFC app that has a user login option and the software will store upto 15 passwords used by a user. Now i want to store each password used by a user in a string array and make sure that the user doesn't use an old password when updating the password. i.e., password once used cannot be re-used and an existing password will expire after a set number of days. The question is what kind of collection class i need to use for efficient management of old passwords? CArray?CList? CString array? Any sample code will help. Thanks in advance.

      S Offline
      S Offline
      Simon Langdon
      wrote on last edited by
      #2

      It sounds like a trivial issue, use whichever types you're comfortable with. STL vectors and CStringArrays both leap to mind; do you need to save this data somehow? CStringArrays support CArchive but you may want to think about encryption or some other safety feature.

      1 Reply Last reply
      0
      • D Donguy1976

        Hello there I am working on a C++ MFC app that has a user login option and the software will store upto 15 passwords used by a user. Now i want to store each password used by a user in a string array and make sure that the user doesn't use an old password when updating the password. i.e., password once used cannot be re-used and an existing password will expire after a set number of days. The question is what kind of collection class i need to use for efficient management of old passwords? CArray?CList? CString array? Any sample code will help. Thanks in advance.

        J Offline
        J Offline
        jeron1
        wrote on last edited by
        #3

        If you're only storing CStrings then CStringArray[^] would be a good choice. If you're storing something else, one of the other collections probably would be more appropriate, here[^] are some examples of thier usage, there are lots of others on the web. here[^] is a link that should help you to decide which collection might be best.

        1 Reply Last reply
        0
        • D Donguy1976

          Hello there I am working on a C++ MFC app that has a user login option and the software will store upto 15 passwords used by a user. Now i want to store each password used by a user in a string array and make sure that the user doesn't use an old password when updating the password. i.e., password once used cannot be re-used and an existing password will expire after a set number of days. The question is what kind of collection class i need to use for efficient management of old passwords? CArray?CList? CString array? Any sample code will help. Thanks in advance.

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

          Donguy1976 wrote:

          The question is what kind of collection class i need to use for efficient management of old passwords?

          Since you are only dealing with 15, and only searching the collection when the user is logging in (e.g., once per day), it likely does not matter the data structure you use.

          "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
          • D Donguy1976

            Hello there I am working on a C++ MFC app that has a user login option and the software will store upto 15 passwords used by a user. Now i want to store each password used by a user in a string array and make sure that the user doesn't use an old password when updating the password. i.e., password once used cannot be re-used and an existing password will expire after a set number of days. The question is what kind of collection class i need to use for efficient management of old passwords? CArray?CList? CString array? Any sample code will help. Thanks in advance.

            CPalliniC Offline
            CPalliniC Offline
            CPallini
            wrote on last edited by
            #5

            If you are happy with MFC containers then CStringArray[^] is fine. As side (though important) note, have a look at out Original's tip: "Password Storage: How to do it."[^].

            Veni, vidi, vici.

            In testa che avete, signor di Ceprano?

            1 Reply Last reply
            0
            • D Donguy1976

              Hello there I am working on a C++ MFC app that has a user login option and the software will store upto 15 passwords used by a user. Now i want to store each password used by a user in a string array and make sure that the user doesn't use an old password when updating the password. i.e., password once used cannot be re-used and an existing password will expire after a set number of days. The question is what kind of collection class i need to use for efficient management of old passwords? CArray?CList? CString array? Any sample code will help. Thanks in advance.

              F Offline
              F Offline
              Freak30
              wrote on last edited by
              #6

              Personally I would use a vector, add a new password at the end when needed and remove the first one when size() becomes larger than 15. The scurity issues were already mentioned in the otherreplies.

              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