I have a member function that asks the user for a file name and then gets input from file and uses it on different functions. Each function takes in chars or chars. However its not quite executing the functions. I think it has to do with sstream picking the data out from the file then making them chars? Is it possible to separate the elements from the file using sstream then use those elements as chars?
void My_Function::file()
{
fstream data;//file input
char filename[80];
string line;
int first;
char sec, third, fourth;
cout<<"Enter file name: \n";
cin>>fileName;
data.open(fileName);
while(getline(data,line))
{
stringstream str(line);
istringstream ins;
ins.str(line);//get line
str >> first >> sec >> third >> fourth;
switch(first)
{
case 1:
add(sec);
break;
case 2:
delete_item(sec, third);
break;
case 3:
print_everything(sec, third);
break;
case 4:
makenew(sec, third);
break;
case 5:
find(sec, third, fourth);
break;
case 0:
break;
}
}
}