A segmentation fault appeared when I tried to run a macro a second time
(it is attached below). But if I include iostream.h directly on the
command line before executing the macro the first time, the segmentation
violation doesn't come afterwards.
Does anybody know why ?
Steve
PS : > Many thanks to Masaharu for the many answers on the limitation
problem
#include <iostream.h>
#include <fstream.h>
error() {
ifstream file("data.dat", ios::in);
gROOT->Reset();
c1 = new TCanvas("c1", "error",700,500);
c1.SetFillColor(0);
c1.SetGridx();
c1.SetGridy();
const int MAX = 2000;
float dose[MAX], voltage[MAX];
int count = -1;
while (!file.eof()) {
++count;
file >> dose[count] >> voltage[count];
}
gr = new TGraph(count, dose, voltage);
gr.SetMarkerColor(4);
gr.Draw("ACP");
c1.Update();
gr.GetHistogram().SetXTitle("dose / rad");
gr.GetHistogram().SetYTitle("voltage / mV");
return(0);
}