Original Post
Ok, I''m making an address book. I gotta be quick so I''ll post more of a description later if needed but I''m having an error with the getline() function. Here''s the class function that uses it:
> &__thiscall std::basic_istream >::getline(char *,int)'' : ca
nnot convert parameter 1 from ''class std::basic_ifstream >'' to ''char *''
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.
Address Book.exe - 1 error(s), 0 warning(s)
I''m using MSVC++ 6.0
R.I.P. Mark Osback Solo Pa Mi Gente VG-Force
class Address_Book
{
public:
Address_Book();
void Add_Address();
void Edit_Address();
void Delete_Address();
private:
vector<DATA> Address_Data;
vector<char*> Addresses;
ofstream Write;
ifstream Read;
char* Line;
};
Address_Book::Address_Book()
{
int i = 0;
Line = "";
Read.open("Addresses.txt");
if (Read.fail())
{
cout << "Unable to load your address book.\n";
Read.close();
}
while(!Read.eof())
{
Read.getline(Read, Line); // error here
Addresses.push_back(Line);
cout << Addresses[i] << endl;
i++;
}
Read.clear();
Read.close();
}
This is what the error says:
C:\Documents and Settings\Michael\Desktop\Projects\Address Book\main.cpp(48) : error C2664: ''class std::basic_istreamR.I.P. Mark Osback Solo Pa Mi Gente VG-Force