Read options from file
- by Devel
I would like to write a function which will read values from a text file and write them to variables. For example my file is:
mysql_server localhost
mysql_user root
mysql_passworg pospaz
mysql_database testgenerator
log log.txt
username admin
password abcd
and I have the same variables as the first word in the line.
So how to make the function read data from file and do sth like this:
char *mysql_server = localhost;
char *mysql_user = root;
...
I have no idea even how to start writing it...