|
|
while(!"Data.txt" == EOF)
is just a string, this line of code references nothing. You would need to use
|
|
Dfile is the object you want to use, replacing all of your data.txt's with Dfile should work. |
home/bruce/C++/Contacts/data.cpp: In member function ‘void data::loadData()’: /home/bruce/C++/Contacts/data.cpp:49:28: error: no matching function for call to ‘std::basic_ifstream<char>::getline(std::ifstream&)’ /home/bruce/C++/Contacts/data.cpp:49:28: note: candidates are: /usr/include/c++/4.6/istream:599:5: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::getline(std::basic_istream<_CharT, _Traits>::char_type*, std::streamsize, std::basic_istream<_CharT, _Traits>::char_type) [with _CharT = char, _Traits = std::char_traits<char>, std::basic_istream<_CharT, _Traits>::char_type = char, std::streamsize = int] /usr/include/c++/4.6/istream:599:5: note: candidate expects 3 arguments, 1 provided /usr/include/c++/4.6/istream:408:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::getline(std::basic_istream<_CharT, _Traits>::char_type*, std::streamsize) [with _CharT = char, _Traits = std::char_traits<char>, std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>, std::basic_istream<_CharT, _Traits>::char_type = char, std::streamsize = int] /usr/include/c++/4.6/istream:408:7: note: candidate expects 2 arguments, 1 provided /home/bruce/C++/Contacts/data.cpp:50:29: error: no matching function for call to ‘std::vector<std::basic_string<char> >::push_back(std::ifstream&)’ /home/bruce/C++/Contacts/data.cpp:50:29: note: candidate is: /usr/include/c++/4.6/bits/stl_vector.h:826:7: note: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::basic_string<char>, _Alloc = std::allocator<std::basic_string<char> >, std::vector<_Tp, _Alloc>::value_type = std::basic_string<char>] /usr/include/c++/4.6/bits/stl_vector.h:826:7: note: no known conversion for argument 1 from ‘std::ifstream {aka std::basic_ifstream<char>}’ to ‘const value_type& {aka const std::basic_string<char>&}’ |
|
|
Note** you might want to error check the file before pushing it into a vector, that could give you some crazy head aches later in the program if you dont check the file(either for being open or the data it holds). |