Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing a File

Status
Not open for further replies.

tewari68

Programmer
Jan 25, 2005
87
US
Hi,
I have a config file which has entries like
Code:
DYNAMICBASEDIR : /var/maildir
DYNAMICTEMPDIR : {DYNAMICBASEDIR}/tmp/
USERDATAMAILFILEDIR : {DYNAMICBASEDIR}/domains/

This is a common config file which is also being parsed by php script and perl scripts.
I have to parse this file in C++, I can get the key value pairs like
Code:
key = DYNAMICTEMPDIR and value = {DYNAMICBASEDIR}/tmp/
Now I have to further parse this key value pair and replace the variable within the curly braces by it's value i.e. /var/maildir,
and create a hash, so that I can reference any of the values by their key.
Appreciate if anybody can help me out with this.

Thanks,
Tewari
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top