I've declared the string realPath as
string realPath;
realPath = "c:/tc/matrix.txt";
when i use realPath for the path of file to open like
fstream infile;
infile.open(realPath, ios::in); //This line generate error like
///////////////////////////////////////
error msg:
1>.\read_matrix _table.cpp(31) : error C2664: 'void std::basic_fstr eam<_Elem,_Trai ts>::open(const wchar_t *,std::ios_base ::openmode,int) ' : cannot convert parameter 1 from 'std::string' to 'const wchar_t *'
1> with
1> [
1> _Elem=char,
1> _Traits=std::ch ar_traits<char>
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
//////////////////////////////////
string realPath;
realPath = "c:/tc/matrix.txt";
when i use realPath for the path of file to open like
fstream infile;
infile.open(realPath, ios::in); //This line generate error like
///////////////////////////////////////
error msg:
1>.\read_matrix _table.cpp(31) : error C2664: 'void std::basic_fstr eam<_Elem,_Trai ts>::open(const wchar_t *,std::ios_base ::openmode,int) ' : cannot convert parameter 1 from 'std::string' to 'const wchar_t *'
1> with
1> [
1> _Elem=char,
1> _Traits=std::ch ar_traits<char>
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
//////////////////////////////////
Comment