전화 번호부를 프로그래밍하고 있는데 파일에서 읽는 데 문제가 있습니다. 오류는 없음에 대한 매치 '연산자 >>'이 함수는 TXT 파일에 쓰기위한'연산자 >>'에 일치하는 항목이 없습니다 (피연산자 유형이 'std :: basic_istream'및 '')
[대기 (피연산자 유형 '표준 : basic_istream보다는'및 '이다)
void PhoneBook::Save(){ while(1)
{
ofstream file;
file.open("test.txt",ios::app);
file<<contact.first<<endl
<<contact.last<<endl
<<contact.areacode<<endl
<<contact.number<<endl
<<contact.email<<endl
<<contact.webaddr<<endl
<<contact.address;
}}
로드 함수이다 :
void PhoneBook::Load()
{
ifstream file("test.txt");
//how i can make it(reading from file)correct?
if (file.is_open())
{
file>>contact.first>>endl
>>contact.last>>endl
>>contact.areacode>>endl
>>contact.number>>endl
>>contact.email>>endl
>>contact.webaddr>>endl
>>contact.address;
}
else
cout<<"error in openening file";
}
http://idownvotedbecau.se/itsnotworking/ – user0042