Converting A Variable Type

I am using a class that requires type char*. To be more specific, I am using a class called, "CINIReader", to read INI files. The file to open requires char* locationOfFile.

However, I have a method from a different class that reads a string from an online message. This string is the name of the INI file.


This is how I find out the name of the file:

string username = readstring();


To open that file, I am required to supply a char* value:

CIniReader iniRead(char *);


Any solutions?

Thank you,
Emmanuel Barroga
Last edited on
Thank you for the advice.
I still seem to be having problems:



string fileDir = "account/";

string userName = readstring(mBuff);

fileDir.append(userName);

const char* file = fileDir.c_str();


#error-> CIniReader iniRead(file);





The ini reader class takes char*

iniRead(char*)




The error:

Invalid conversion from 'const char*' to 'char*'
CIniReader iniRead((char*)fileDir.c_str());

C++ complains about implicit conversions.
Topic archived. No new replies allowed.