ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Hi i need an example or a program (so as to read the code) in order to understand how i can read parameters from a file (something like /etc/smb.conf)
Have a nice day
I could give you some examples of routine, but has they are "home made", they would probably be not undersandablefor someone who don't know how to use it ...
Serch about "fopen" and "fread".
The basis is that you have to :
open the file using fopen. (with option read/write..., type of file suc binary or text)
read it to memory, using a routine, using fread.
close the file after use.
Once the file is transfered into memory, you need to extract the data interesting yourself.
It's not really difficult... once you have founded how to do.
I don't know how deep you are aware in C programming, but it's like all read/write of datas (pipes, sockets,...)
The best I could suggest you, if you don't find it using Google, is to buy a serious book of system programming. They all talk about this subject. I could give you a very good reference but it's french.
Thx for the link ... but i dont have the money to afford it... If u can help me a little more e.x provide me some sample code if u have some so i can undestrand how i can parse parameters from a file
the file will have the following format
parameter1=value1
parameter2=value2
parameter3=value3
so i need some generic functions for parsing parameters as well the values... If u dont have the time plz suggest me how to start... thx a lot
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.