creating a text menu from an ini file in C
-
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
-
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
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
-
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
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
-
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
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.
-
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.
-
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
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 asprintf
,scanf
,getchar
,gets
et al.Jeremy Falcon jeremyfalcon.com[^]