trying to read a config file
<p>sorry in advance for the formatting. Couldn't figure it out...</p>

<p>I'm passing a config file to a program via arguments</p>

<p>I'm trying to read a value from a specific parameter</p>

<p>I've got a cofigReader class with the following method for returning a string from a config file given a specific parameter</p>

<p>My problem, </p>

<p>it never finds the parameter. found is either 0 or -1....</p>

<pre><code>string configReader::value(string config_file, string parameter)
{
    string value;
    char config_delimiter = '=';
    size_t found;
    file.open(config_file);
    std::string line;
    bool param_found = false;
    while(param_found == false){
        while (!file.eof())
        {       
            getline(file,line);
            logger.writetolog("INFO","Looking for " + parameter +
                         " on line "+ line); 
            found = line.find(parameter);
            logger.writetolog("INFO",int(found));
            if(found!=string::npos){
                param_found = true;
            }
        }
        param_found = true;
    }
    if (found!=string::npos)
    {   
        size_t a = line.find(config_delimiter)+1;
        logger.writetolog("INFO","Found" + parameter + 
                   "splitting string at delimter" + config_delimiter + 
                   " and return right side value");     
        value = line.substr(a);
        return value;
    }
    else
    {
        return value;
    }
    file.close();
}
</code></pre>

<p>more info. Config file reads like this. </p>

<pre><code>toemail=someemailaddress@gmail.com
outputdir=C:\tmp
</code></pre>

<p>configReader class used like this</p>

<pre><code>//attempt to parse out the required parameters for the program
string toemail = config.value(configFileArg,"toemail"); 
</code></pre>

<p>it ALWAYS return empty</p>
