Why this function overloading is not working?

Posted by Jack on Stack Overflow See other posts from Stack Overflow or by Jack
Published on 2010-04-27T12:09:23Z Indexed on 2010/04/27 12:13 UTC
Read the original article Hit count: 167

Filed under:
|
class CConfFile
{
    public:
        CConfFile(const std::string &FileName);
        ~CConfFile();
        ...
        std::string GetString(const std::string &Section, const std::string &Key);
        void GetString(const std::string &Section, const std::string &Key, char *Buffer, unsigned int BufferSize);
        ...
}

string CConfFile::GetString(const string &Section, const string &Key)
{
    return GetKeyValue(Section, Key);
}

void GetString(const string &Section, const string &Key, char *Buffer, unsigned int BufferSize)
{
    string Str = GetString(Section, Key);     // *** ERROR ***
    strncpy(Buffer, Str.c_str(), Str.size());
}

Why do I get an error too few arguments to function ‘void GetString(const std::string&, const std::string&, char*, unsigned int)' at the second function ?

Thanks

© Stack Overflow or respective owner

Related posts about c++

Related posts about overloading