J
Javier
Hi All
I'm in a nightmare trying to do a simple c++ program...
I want to read a file that will have strings in a vector. The path where
is the file is in a ini file.
I did:
--------------------
void main(void) {
// example of using the setINIFileName method
CIniReader m_IniReader;
CString m_strINIFile = ".\\javier.ini";
m_IniReader.setINIFileName (m_strINIFile);
CString pathPhones = m_IniReader.getKeyValue("pathPhones","main");
cout << "pathPhones es " << pathPhones;
std::vector<std::string> phones;
std::ifstream in(pathPhones + "phones.txt"); // Line 28
for (std::string line; std::getline(in, line); )
phones.push_back(line);
}
---------------------
And I get error messages at compile time:
C:\Temp\PruebaIni\PruebaIni.cpp(28) : error C2079: 'in' uses undefined
class 'basic_ifstream<char,struct std::char_traits<char> >'
C:\Temp\PruebaIni\PruebaIni.cpp(28) : error C2440: 'initializing' :
cannot convert from 'class CString' to 'int'
No user-defined-conversion operator available that can perform
this conversion, or the operator cannot be called
C:\Temp\PruebaIni\PruebaIni.cpp(30) : error C2780: 'class
std::basic_istream<_E,_Tr> &__cdecl std::getline(class
std::basic_istream<_E,_Tr> &,class std::basic_string<_E,_Tr,_A> &,const
_E)' : expects 3 arguments - 2 provided
c:\archivos de programa\microsoft visual
studio\vc98\include\string(149) : see declaration of 'getline'
C:\Temp\PruebaIni\PruebaIni.cpp(30) : error C2784: 'class
std::basic_istream<_E,_Tr> &__cdecl std::getline(class
std::basic_istream<_E,_Tr> &,class std::basic_string<_E,_Tr,_A> &)' :
could not deduce template argument for 'class std::basic_istream<_
E,_Tr> &' from 'int'
Error executing cl.exe.
Could somebody help me ?
Thanks in advance
J
I'm in a nightmare trying to do a simple c++ program...
I want to read a file that will have strings in a vector. The path where
is the file is in a ini file.
I did:
--------------------
void main(void) {
// example of using the setINIFileName method
CIniReader m_IniReader;
CString m_strINIFile = ".\\javier.ini";
m_IniReader.setINIFileName (m_strINIFile);
CString pathPhones = m_IniReader.getKeyValue("pathPhones","main");
cout << "pathPhones es " << pathPhones;
std::vector<std::string> phones;
std::ifstream in(pathPhones + "phones.txt"); // Line 28
for (std::string line; std::getline(in, line); )
phones.push_back(line);
}
---------------------
And I get error messages at compile time:
C:\Temp\PruebaIni\PruebaIni.cpp(28) : error C2079: 'in' uses undefined
class 'basic_ifstream<char,struct std::char_traits<char> >'
C:\Temp\PruebaIni\PruebaIni.cpp(28) : error C2440: 'initializing' :
cannot convert from 'class CString' to 'int'
No user-defined-conversion operator available that can perform
this conversion, or the operator cannot be called
C:\Temp\PruebaIni\PruebaIni.cpp(30) : error C2780: 'class
std::basic_istream<_E,_Tr> &__cdecl std::getline(class
std::basic_istream<_E,_Tr> &,class std::basic_string<_E,_Tr,_A> &,const
_E)' : expects 3 arguments - 2 provided
c:\archivos de programa\microsoft visual
studio\vc98\include\string(149) : see declaration of 'getline'
C:\Temp\PruebaIni\PruebaIni.cpp(30) : error C2784: 'class
std::basic_istream<_E,_Tr> &__cdecl std::getline(class
std::basic_istream<_E,_Tr> &,class std::basic_string<_E,_Tr,_A> &)' :
could not deduce template argument for 'class std::basic_istream<_
E,_Tr> &' from 'int'
Error executing cl.exe.
Could somebody help me ?
Thanks in advance
J