I have a log, file from my last post about snmp loging. I got the logging application up and running. But the log file it creates is not good for what i need.
I am looking for a way to read spesific part of each line in a txt file lite this:
SNMPv2-SMI::enterprises.12394.1.2.7.2.5.3.0 = STRING: "27.50"
SNMPv2-SMI::enterprises.12394.1.2.7.2.5.3.0 = STRING: "27.30"
SNMPv2-SMI::enterprises.12394.1.2.7.2.5.3.0 = STRING: "27.40"
I just need to read the number at the end, so in the cutout above i would need to read 27.50 from line one, 27.30 from line 3, 27.40 from line 5.
I have been playin around with somthin like this, but i feel like i have very little control doing it this way:
Code:
int main()
{
string first, last;
//string line;
ifstream my_file("logtest01.txt");
if(my_file.is_open() )
{
while( my_file )
{
my_file >> first >> last;
cout << "Snr UL" << " " << last << endl;
}
}
system("pause");
return 0;
And the best formatting i can com up with looks like this:
Snr UL =
Snr UL "27.50"
Snr UL =
Snr UL "27.30"
Snr UL =
Snr UL "27.40"
Snr UL =
Snr UL "27.50"
Snr UL =
Snr UL "27.40"
Snr UL =
Snr UL "27.30"
Snr UL =
Snr UL "27.50"
Snr UL =
Snr UL "27.40"
Snr UL =
Snr UL "27.40"
Snr UL =
Snr UL "27.10"
Snr UL "27.10"
Any hints as to where to look?
Regards
Chris