#include<string>
using namespace std;
int main(){
const int SIZE=50;
int count=0;
ifstream fin("phoneData.txt");
ofstream fout("phoneList.txt");
string firstName, lastName, phoneNumber;
if (!fin){
cout<<"Error opening file. program ending."<<endl;
return 0;
}
while (count<SIZE && fin>>phoneNumber[count]){
fin.ignore();
getline (fin, firstName[count], '\n');
fin>>lastName[count];
count++;
}
return 0;
Here is my code so far. in my while loop, something is wrong with the getline, i keep getting an error message like this:
error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ifstream'
1> c:\program files\microsoft visual studio 9.0\vc\include\string(475) : see declaration of 'std::getline'
please help!!! i can't figure it out!