Dear all,
I am trying to read a binary file input.ndf which is supplied externally. The problem statement is as follows:
There are neutron rays passing through the sample and gets detected by the detector. I am creating a grid from the input.ndf file. In the grid, in case there is a part of the sample, it is filled by 1 or 0. I am dynamically allocating the 3-d grid and 2-d detector. I am having problems with reading the file. I have attached the code below. Kindly help me. I am quite new to programming. So, kindly give your suggestions.
[code]
#include<iostream>
#include<fstream>
using namespace std;
typedef struct read
{
int xn,yn,zn,detyn,detzn;
double xd,yd,zd,det_yd,det_zd,qq;
//int i,j;
//double temp;
}r1;
cout<<" the contents are "<<read1(xn,yn,zn,detyn,detzn,xd,yd,det_yd,det_zd,Q)<<endl;
cout<<"the contents are "<<read2(xn,yn,zn,detyn,detzn,grid,detector)<<endl;
return 0;