HELP! Any C++ experts out there?

mosdef

Banned
May 14, 2000
2,253
0
0
Any C++ experts out there that I could speak online with about a program I'm struggling with? Thanks.

-mosdef
 

BCYL

Diamond Member
Jun 7, 2000
7,803
0
71
What are you having trouble with?

You might wanna post your problem here so more ppl can give you feedbacks...
 

mosdef

Banned
May 14, 2000
2,253
0
0
Ok I figured out what the problem is, but how should I solve it? I'm reading in characters from a file.

while( !inAirlines.eof() )
{
...
}

Will this detect eof? Also, what's the best way to get to the next line in the file?

-mosdef
 

SnoopCat

Senior member
Jan 19, 2001
926
0
0
ifstream instream;

string s;

vector<string> storage;
int i =0;

instream.open(dafilename.c_str())

if (instream.fail())
{
cout << &quot;the file was unable to be opened&quot;;
return;
}

while(!instream.fail())
{
storage.push_back(s);

getline(instream,s);
i++;
}

instream.close;



for (int x=0; x <=instream.size(); x++)
{
cout << storage[x] << endl;
}


return;
}