Problem reading data from file and record it for use in program
I have got a problem with reading data from a file and use it during the process of the program.
I have a program that controls an interface card and that is working fine. At this moment I configure the settings in the code, but what I want is the possibility to set the configuration of the interface by using a file. I'm programming in C and use a Linux Kernel.
The layout of the file will be as follow;
# Standard network interface parameters
# Other media options are x21, v24 and v35
# Network protocols are PPP, RAW or CISCO
# We are a DCE and provide clock at the specified rate
So what I want is that the code does something like this:
when you find "DEVICE=" record the device name
when you find "MEDIA=" record the media type (v24, v35, x21)
when you find "PROTO=" record the proto type
when you find "CLOCK=" record the clock speed
After this it must be possible to use the recorded value's in other parts of the program.
Only I don't now how to create this. Can someone help me!!
Thanks for all your support.