F
Francis Bell
I just found that my fin stream is not getting passed to my
readInASpinnerbait function. Here's what I have:
string readInFirstChars(ifstream &fin)
{
char first[2];
string print;
while (fin.good())
{
fin.get(first, 4, '/');
if (strcmp(first, "sp")==0) {
cout << first << endl; // debugging: outputs 'sp'
string print = "spinnerbait";
readInASpinnerbait(fin); // fin not getting passed
fin.ignore(80, '\n');
return print;
}
}
return 0; }
void readInASpinnerbait(ifstream &fin)
{
cout << "it should read 'sp' right after this" << endl; //it doesn't
char first[2];
string print;
fin.get(first, 4, '/');
cout << first << endl;
// debugging: it doesn't output 'sp'...so fin is not getting
passed.
Spinnerbait spinnerbaitLure;
SpinnerbaitList spinList;
spinnerbaitLure.inputSpinnerbait(fin);
while (!fin.fail()) {
spinList.insertSpinnerbait(spinnerbaitLure, 0);
spinnerbaitLure.inputSpinnerbait(fin);
}
}
I don't understand why fin wouldn't be getting passed here. This seems
simple enough. On a whim, I even tried changing that to istream &sin.
No go. I'd appreciate ANY input. Thanks!
Frank
readInASpinnerbait function. Here's what I have:
string readInFirstChars(ifstream &fin)
{
char first[2];
string print;
while (fin.good())
{
fin.get(first, 4, '/');
if (strcmp(first, "sp")==0) {
cout << first << endl; // debugging: outputs 'sp'
string print = "spinnerbait";
readInASpinnerbait(fin); // fin not getting passed
fin.ignore(80, '\n');
return print;
}
}
return 0; }
void readInASpinnerbait(ifstream &fin)
{
cout << "it should read 'sp' right after this" << endl; //it doesn't
char first[2];
string print;
fin.get(first, 4, '/');
cout << first << endl;
// debugging: it doesn't output 'sp'...so fin is not getting
passed.
Spinnerbait spinnerbaitLure;
SpinnerbaitList spinList;
spinnerbaitLure.inputSpinnerbait(fin);
while (!fin.fail()) {
spinList.insertSpinnerbait(spinnerbaitLure, 0);
spinnerbaitLure.inputSpinnerbait(fin);
}
}
I don't understand why fin wouldn't be getting passed here. This seems
simple enough. On a whim, I even tried changing that to istream &sin.
No go. I'd appreciate ANY input. Thanks!
Frank