Don't mind the functions you don't see declarations for, I've error checked everything. I just can't see why it seems to skip this one part. Where I use getline. Is there something wrong with this algorithm? I'm trying to get the variable to only be defined as that string when it's on the proper line. I do this by using getline and the file open properties. I'm using visual c++ 6.0. Anybody see something that I don't?
Code:
bool cortana::name_check()
{
ifstream checkfile("profile.txt");
checkfile >> file;
checkfile.close();
if(file!="")
{
return true;
}
else
{
return false;
}
}
void cortana::talk()
{
string str;
int linenumber=0;
bool data=cortana::name_check();
if(data==true)
{
ifstream getinfo("profile.txt");
while(linenumber!=3)
{
getline(getinfo,str,'\n');
if(linenumber==1)
{
botname=str;
}
if(linenumber==2)
{
name=str;
}
linenumber++;
}
getinfo.close();
}
if(data==false)
{
botname=cortana::find_names();
name=cortana::find_player();
}
system("cls");
cout << "Hello, " << name << ". I am " << botname << "." << endl;
}