Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
handling Java properties
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Time Waster, post: 3681313"] Java property files are dead simple: key1=val1 some.key2=val2 For simplicity on the Java side, I'd like to use these files from C as well (the C program and Java program must cooperate). Anyone have any bright ideas on handling this sort of thing from C? Is there any preexisting libraries or calls that would help? One idea I had was to have a big enumerated type of the key names (which are known ahead of time): enum { key1 = 0, key2, key3 , MAXKEY} char *keys[MAXKEY]; Then as I read the keys from the file, I could somehow fill in the array: <read key1=val1> keys[key1] = val1; But that led me to the dead end because even if I have stringvar == "key1" that doesn't get me to the bareword needed to have an enumerated reference. Of course, I could have another stupid array of structs defined mapping the key1 enumeration thingy to "key1" as a string, but that seems kind of ugly. Is there a way to get the enumerated constant key1 from the string value "key1"? TIA [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
handling Java properties
Top