Re: reading from a file into an array

From: Moonlit (alt.spam_at_jupiter.universe)
Date: 11/07/03


Date: Fri, 7 Nov 2003 19:50:09 +0100

Sorry forgot

#include <fstream>

Regards,
"Moonlit" <alt.spam@jupiter.universe> wrote in message
news:3fabe927$0$58700$e4fe514c@news.xs4all.nl...
> Hi,
>
> "Allen Seelye" <Aseelye@blackfoot.net> wrote in message
> news:bogmti01qdo@enews3.newsguy.com...
> > Newbie here. I'm having a hell of a time with this. It takes input from
> > the console into an array and then dumps it into a file. that all is
> > pretty straight forward and works just fine. The output file looks like
> > this:
> >
> > 1,John Smith, 5551234, 1515 Some St
> > 2,Jane Smith, 5555678, 1515 Someother St
>
> #include <string>
> #include <algorithm>
> using namespace std;
>
> ifstream Input( Filename.c_str() );
>
> if( !Input.is_open() )
> {
> // Error handling
> }
> else
> {
> string Line;
> while( getline( Input, Line ) )
> {
>
> }
> }
>
> Regards, Ron AF Greve.
> >
> > ...and so on. I've had no success getting this read back into an array.
> > I've got three books on C++ and none of them has any information on how
> > to accomplish this. Even if someone could show me how to read each line
> > in as a single string I could probably figure it out from there on my
own.
> >
> > Any help would be greatly appreciated.
> >
> > --
> > Allen Seelye
> > Aseelye@blackfoot.net
> >
>
>



Relevant Pages