I want to open a file in my code ( Visual C++ 2005) in the way that the file name contains some variables.
while i using f.open("file_na me.ext") ; i prefer to put a string instead of fix name
i receive an error
error C2664: 'void std::basic_ofst ream<_Elem,_Tra its>::open(cons t wchar_t *,std::ios_base ::openmode,int) ' : cannot convert parameter 1 from 'std::string' to 'const wchar_t *'
with
[
_Elem=char,
_Traits=std::ch ar_traits<char>
]
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
help me out plz
while i using f.open("file_na me.ext") ; i prefer to put a string instead of fix name
Code:
string s; s="name1.ext"; ofstream f; f.open(s);
error C2664: 'void std::basic_ofst ream<_Elem,_Tra its>::open(cons t wchar_t *,std::ios_base ::openmode,int) ' : cannot convert parameter 1 from 'std::string' to 'const wchar_t *'
with
[
_Elem=char,
_Traits=std::ch ar_traits<char>
]
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
help me out plz
Comment