How to read value Below "MEAN" in c??
I want to read CEL file and display numbers below Mean column.?
Contain in CEL file are
[CEL]
Version=3
[HEADER]
Cols=744 Rows=744
TotalX=744 TotalY=744
OffsetX=0 OffsetY=0
GridCornerUL=1 1
GridCornerUR=744 1
GridCornerLR=744 744
GridCornerLL=1 744
Axis-invertX=0
AxisInvertY=0
swapXY=0
DatHeader= U133AAofAv2.1sq
Algorithm=Percentile
AlgorithmParameters=Perce...
[INTENSITY]
NumberCells=553536
Cell Header=X Y MEAN STDV NPIXELS
0 0 717.5 212.2 36
1 0 28103.0 6666.0 36
2 0 908.3 211.7 36
- -------------------- upto----
743 0 219.0 122.3
My code is---->
#include<iostream>
#include<fstream>
#include<string>
#include<stdio.h>
#include<conio.h>
using namespace std;
int data(int);
int main()
{
char my_char;
int i;
// ask user for the files
size_t counter(0); // how many found
string if_name;
string of_name;
cout << "Enter the name of the file to read, including file extention" << endl;
cin >> if_name;
cout << "and the file to write to" << endl;
cin >> of_name;
// clear iostate just in case and open file
ifstream in_file;
ofstream out_file;
in_file.close();
in_file.clear();
out_file.close();
out_file.clear();
in_file.open(if_name.c_str(), ifstream::in);
out_file.open(of_name.c_str(), ofstream::out | ofstream::ate);
long ab;
if((in_file.is_open()) && (out_file.is_open()))
{
cout << "Open complete" << endl;
// achive goal
string content;
string word;
// static unsigned int line_no = 1;
const int word_length = word.size();
char word_copy[(word_length + 1)];
size_t found;
int str_length;
cout << "What string do you want to find? " << endl;
cin >> word;
while(getline(in_file, content) || (!in_file.eof()))
{
static unsigned int line_no = 1;
found = content.find(word.c_str());
// getch();
if (found != string::npos)
{
cout << "Match found in line " << line_no << " at: " << found << endl;
++counter;
for(i=0;i<744;i++)
{
//while(my_char!='\n')
in_file>>my_char;
while((!in_file.eof()) && (my_char != '\n'))
{
my_char = in_file.get() ;
cout<<my_char; //Here i get all data
// getch();
}
}
line_no=line_no+1;
printf("\n%d",line_no);
// data(line_no);
str_length = content.copy(word_copy, word_length, found);
word_copy[str_length]= '\0';
cout << "\nword_copy: " << word_copy << endl;
break;
// out_file << word_copy << endl;
}
else {
//cout << "NO match found in line "<<endl;
//getch();
} // end second if
++line_no;
} // end while loop
in_file.close();
out_file.close();
}
else
{
cout << "Open failed.";
getch();
} // end first if
cout << "The string was found " << counter << " times in the file " << endl;
getch();
}
int data(int a)
{
printf("\nIN data");
int x=a+1;
printf("\n%d",x);
}
But want out put like
0 212.2
1 6666.0
2 211.7
3 6829.7
4 170.8
-------------
743 5785.3