I'm trying to write some code to an output file. The function reads data in text format and then tries to write results after the data has been processed in other source code. The resulting data (data to be written) is actually an array of values, but i get error c2679. The 2 codes are as follows:
The function which contains code for writing my output file is:
I don't know why I have this error. Is the problem with code 2? or with the way I called the function in "outputdeck"?
Code:
//code 1: Code which returns the array of results
void dimpress(double *pD,int nSize)
{
for (int t=0;t<nSize;t++)
{
double tdim[1],dimrw[1],dimpress[20],gwk[20],rwD;
double tD,rD = 0.0;
float Lw,rw;
int K;
CKuchukDlg MyClass;
MyClass.m_fHLength = Lw;
MyClass.m_fWellRad = rw;
MyClass.m_iSLayer = K;
Stfst = new Stehfest(nSize);
tdim[K] = (0.0002637*kh_md[K])/(por[K]*visc_cp[K]*ct_psi[K]*pow(Lw,2));
tD += tdim[K];
dimrw[K] = (rw/(2*Lw))*(1+sqrt(kh_md[K]/kv_md[K]));//for the transversely isotropic medium
rwD += dimrw[K];
Stfst -> SetLaplacePoints(tD);
void gwkfinal(double *gwk, int nSize);
gwkfinal(gwk,20);
s= 2*t*PI;
pD[t] = (2.0*gwk[t]*rwD)/s;
dimpress[t] = Stfst -> InverseTransform(pD,tD);
}
}
The function which contains code for writing my output file is:
Code:
//Code 2
void CKuchukDlg::OnAnalyze()
{
// TODO: Add your control notification handler code here
// let maximum number of layers = 100: this value can be modified.
int num_layers = 100;
int i = 0; // index to count what line is being read;
extern int K; // K = source layer number
double H_ft[100],kh_md[100], kv_md[100],visc_cp[100], por[100], ct_psi[100];
char line[100];
ifstream inputdeck;
inputdeck.open("input.txt", ios::in);
if (inputdeck.fail())
{
//cout<<"Error With Files!";
AfxMessageBox("File Read Error!", MB_OKCANCEL|MB_ICONSTOP);
}
else
{
//CAN ONE USE SkipComment() for these?
inputdeck.ignore(60,'\n');
inputdeck.ignore(60,'\n');
while (i<=K && inputdeck.getline(line,100))
{
inputdeck>>H_ft[i]>>kh_md[i]>>kv_md[i]>>visc_cp[i]>>por[i]>>ct_psi[i];
i++;
} /* while block */
}
ofstream outputdeck;
outputdeck.open("output.txt", ios::out);
/*code to test that inputdeck.ignore actually works
outputdeck<<inputdeck.rdbuf(); --> it does! the 1st 2 lines are skipped*/
outputdeck<<"Pressure\n";
extern double pD[20];//from code 1
extern void dimpress(double *pD,int nSize);
outputdeck<<dimpress(pD,20)<<"\n";//ERROR C2679:binary '<<'no operator defined, which takes a righ-hand operand of type 'void' (or there is no acceptable conversion)
outputdeck.close();
AfxMessageBox("Output file Generated!!", MB_ICONINFORMATION|MB_OK);
}
I don't know why I have this error. Is the problem with code 2? or with the way I called the function in "outputdeck"?