I have to open a file whose name i am constructing by concatenating various inputs from the user.
If I write:

string s = "filename.csv";
ofstream fout;
fout.open(s,ios::app);

it gives error for using s in fout.open(). It says it is a wrong form. I need to use a const char

I already answered this in your other thread.

But here goes: fout.open(s.c_str(),ios::app);

I am so sorry for not reading the older post and thank you. It worked.

Mark it as solved then!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.