file.open(..); string parameter
Hi all,
I've been making this program for a training but I've found this problem...
whem I use file.open I want to name the file with the content of a string variable..
for example
1 2 3
|
string name = "text";
file.open(name + ".txt");
|
Visual C++ say that the variable can't be a string-type...How to solve it?
Thanks in advance and sorry for my English but I'm 15 and I'm Italian
file.open ( ( name + ".txt" ).c_str() );
.c_str() converts C++ strings in C strings
Topic archived. No new replies allowed.