Hi,
Can anyone help me with the following problem:
I have to read values from a DetectorLowEnergyGainMap.txt file on the disk that is filled with values like: -128,-10,-30,0, -200 etc. I can read the file with the following code:
Code:
char LowEnergyGainMap[300];
bool TMainForm::LeesDetectorLowEnergyGainMap()
{
fstream inputfile;
inputfile.open("DetectorLowEnergyGainMap.txt"); //
FileName = ExtractFileName(OpenDialog->FileName);
SourceFileDir = ExtractFileDir(OpenDialog->FileName);
if(!inputfile) {
UpDateStatusLine(StatusLineRight,"Detector data file niet geladen !!!");
return FALSE;
}
while(!inputfile.eof()) {
inputfile.getline(LowEnergyGainMap, sizeof(LowEnergyGainMap));
}
inputfile.close();
UpDateStatusLine(StatusLineRight,FileName + " data file geladen !!!");
return TRUE;
}
So far, everything works fine. If I display the data e.x. with ShowMessage(LowEnergyGainMap) I can see that my array LowEnergyGainMap is filled now with the correct data.
Now if I try to display the data in a TChart with the code below, all the bars are displayed as positive bars and not with the data that is in the LowEnergyGainMap.
Code:
if(WhichRange == "NR"){
for (t=0; t<NumberOfTubes; t++) { // Normal Range
PMTGainNRDet1->Add(LowEnergyGainMap,t+1,GetDefaultColor(16));
}
I know that in the call: Add(LowEnergyGainMap,t+1,GetDefaultColor(16)) LowEnergyGainMap should be declared const double. I think that my problem resides here.
So, in general, how can I read the datavalues from the text file and display them as bars in the TChart.
Any suggestions are very welcome. Thanks in advance
Johan Ditzel