From: "Paul Ranson"
This is a multi-part message in MIME format.
------=_NextPart_000_00A4_01C4C84C.45C821F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
You need to go into more detail. But consider using a class to hold a =
representation of a line of the log file,
class LogFileRow
{
private :
std::string elem1 ;
std::string elem2 ;
// etc
public :
LogFileRow ( const std::string& rawrow )
{
// extract elements from raw row
}
} ;
And then you could store your rows in a vector
std::vector rows ;
And read the file like this,
std::ifstream is ( "MyFileName" ) ; std::string sbuf ;
while ( is.good )
{
is.getline ( sbuf ) ;
rows.push_back ( LogFileRow ( sBuf )) ;
}
But it's probably worth considering which elements you want to store and =
what a natural way to store them is, for instance there's no point in =
storing times or IP addresses as strings, convert them in LogFileRow.
I'm guessing some of the stuff above looks a bit odd...
Paul
"Geo" wrote in message
news:4193f6f8$1{at}w3.nls.net...
> "Paul Ranson" wrote in message
> news:41935a01$1{at}w3.nls.net...
>> The C++ library includes 'string'. What types of operations do you =
want to
>> perform?
>=20
> I want a 2 dimensional array where each element contains a string =
value. I'm
> trying to write a statistics program that reads in a log file then
> calculates stats. But most of the log file is email addresses, IP =
addresses,
> domain names, etc.
>=20
> Geo.
>=20
>
------=_NextPart_000_00A4_01C4C84C.45C821F0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
You need to go into more detail. But consider using =
a class to=20
hold a representation of a line of the log file,
class =
LogFileRow
{
private =
:
=
std::string=20
elem1 ;
=
std::string=20
elem2 ;
// =
etc
public =
:
=
LogFileRow (=20
const std::string& rawrow )
=
{
// extract
elements from raw=20 row
=
}
} =
;
And then you could store your rows in a =
vector
std::vector<LogFileRow>=20
rows ;
And read the file like this,
std::ifstream =
is (=20
"MyFileName" ) ;
std::string =
sbuf=20
;
while ( is.good =
)
{
=
is.getline (=20
sbuf ) ;
=
rows.push_back (=20
LogFileRow ( sBuf )) ;
}
But it's probably worth considering which elements =
you want to=20
store and what a natural way to store them is, for instance there's no = point in=20
storing times or IP addresses as strings, convert them in=20
LogFileRow.
I'm guessing some of the stuff above looks a bit=20
odd...
Paul
"Geo" <mailto:georger{at}nls.net">
size=3D2>georger{at}nls.net> wrote in message =
news:4193f6f8$1{at}w3.nls.net...> "Paul Ranson" <mailto:paul{at}barkto.com">
size=3D2>paul{at}barkto.com> wrote in = message>=20
news:41935a01$1{at}w3.nls.net...>> The C++=20 library includes
'string'. What types of operations do you want =
to>>=20
perform?> > I want a 2 dimensional array
where each = element=20
contains a string value. I'm> trying to write a statistics
= program that=20
reads in a log file then> calculates stats. But most of
the log = file is=20
email addresses, IP addresses,> domain names,
etc.> =
>=20
Geo.> >
------=_NextPart_000_00A4_01C4C84C.45C821F0--
--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)
SEEN-BY: 633/267 270 5030/786
@PATH: 379/45 1 396/45 106/2000 633/267
|