Read options from file
Posted
by Devel
on Stack Overflow
See other posts from Stack Overflow
or by Devel
Published on 2010-03-27T21:50:30Z
Indexed on
2010/03/27
21:53 UTC
Read the original article
Hit count: 157
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...
© Stack Overflow or respective owner