Hi

I am new to C. I want use properties file in C like how we use in "java" and "Perl". I want to read the values from a file and have to use those values in another file. This logic is to avoid hardcoding username and password.

Recommended Answers

All 2 Replies

Use FILE* and associated functions in stdio.h then read the file. Exactly how to go about parsing the file will depend on the format of each line. You could make up your own format or use one that many other programs use, such as

name=ArjunRaja
password=1234
age=23

Thanks for the reply Ancient Dragon!!!!The Properties file format is same "name=arjunraja". I am using C with Linux OS. Where can i find stdio.h? and how to modify stdio.h? I tried with user created .h file like "prop.h". I added "prop.h" file in n number of files where i want to use prop.h values. But it gives error "Cant read Source file" while compilation. It would be great if you provide the Code Snippet?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.