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="Chris Dollin, post: 3681362"] `fgets` to read lines, `strchr` to find characters, `malloc` to allocate space -- that sort of thing? Mmmm. All the values had better have the same type, then. No. You'll have to map from the name to the value. Or you could just look the things up on demand. /Someone/ has to have that mapping. This is "Mr Bare Bones" C, so it's the programmers job to define the mapping. I'd just have a hash table mapping the keys (eg "some.key2") to their values ("val2") and load that from the property file. I'm likely to have hash-table code around anyway, so I'd use that. I wouldn't bother with the `keys` array: for rarely-accessed elements I don't think it's worth it, for frequently-accessed elements I'd probably end up stuffing them into some context object with a more useful access path than `keys[ENUM]`. Not built-in, no. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
handling Java properties
Top