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. creating a text menu from an ini file in C

creating a text menu from an ini file in C

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
6 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
    alleyes 0
    wrote on last edited by
    #1

    I have to have a list of choices in a text menu for a console app in C. The text menu is to be populated from strings read from an INI file. Anyone ever done anything like this? For example: [Model-A] 1="XYZ, Location = ABC" 2="GHI, Location = DEF" I want to read the section then populate some strings based on the number of keys read. The string then is parsed using the string delimiter. Appreciate the help.

    Jer 29:11

    A M J 3 Replies Last reply
    0
    • A alleyes 0

      I have to have a list of choices in a text menu for a console app in C. The text menu is to be populated from strings read from an INI file. Anyone ever done anything like this? For example: [Model-A] 1="XYZ, Location = ABC" 2="GHI, Location = DEF" I want to read the section then populate some strings based on the number of keys read. The string then is parsed using the string delimiter. Appreciate the help.

      Jer 29:11

      A Offline
      A Offline
      Adam Maras
      wrote on last edited by
      #2

      Well, if you're doing any of this in C++, CodeProject has quite a few good examples[^] to get you started. Otherwise, I'm sure someone[^] has come up with a solution :)

      Adam Maras | Software Developer Microsoft Certified Professional Developer

      A 1 Reply Last reply
      0
      • A Adam Maras

        Well, if you're doing any of this in C++, CodeProject has quite a few good examples[^] to get you started. Otherwise, I'm sure someone[^] has come up with a solution :)

        Adam Maras | Software Developer Microsoft Certified Professional Developer

        A Offline
        A Offline
        alleyes 0
        wrote on last edited by
        #3

        I do have an IniFile Class but the majority of code is ANSI C. I have an INI file that is read and choice are presented to the user with a static text menu. If the INI file changes (grows) then I have to rev. code. I would rather rev. the INI file.

        Jer 29:11

        1 Reply Last reply
        0
        • A alleyes 0

          I have to have a list of choices in a text menu for a console app in C. The text menu is to be populated from strings read from an INI file. Anyone ever done anything like this? For example: [Model-A] 1="XYZ, Location = ABC" 2="GHI, Location = DEF" I want to read the section then populate some strings based on the number of keys read. The string then is parsed using the string delimiter. Appreciate the help.

          Jer 29:11

          M Offline
          M Offline
          Maximilien
          wrote on last edited by
          #4

          your issue(s) is/are with a) reading the INI file ? (see How to read and write an INI File[^]) b) creating a text based menu ? (see Text-based menu class for Console Applications[^] c) all of the above ? d) none of the above ?

          This signature was proudly tested on animals.

          A 1 Reply Last reply
          0
          • M Maximilien

            your issue(s) is/are with a) reading the INI file ? (see How to read and write an INI File[^]) b) creating a text based menu ? (see Text-based menu class for Console Applications[^] c) all of the above ? d) none of the above ?

            This signature was proudly tested on animals.

            A Offline
            A Offline
            alleyes 0
            wrote on last edited by
            #5

            Choice 'C' but not using C# which the link in choice 'B' is based upon.

            Jer 29:11

            1 Reply Last reply
            0
            • A alleyes 0

              I have to have a list of choices in a text menu for a console app in C. The text menu is to be populated from strings read from an INI file. Anyone ever done anything like this? For example: [Model-A] 1="XYZ, Location = ABC" 2="GHI, Location = DEF" I want to read the section then populate some strings based on the number of keys read. The string then is parsed using the string delimiter. Appreciate the help.

              Jer 29:11

              J Offline
              J Offline
              Jeremy Falcon
              wrote on last edited by
              #6

              Google the GetPrivateProfileString API to help read from an INI file. Once you have the values you can create the menu using regular STDOUT and STDIN routines such as printf, scanf, getchar, gets et al.

              Jeremy Falcon jeremyfalcon.com[^]

              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