8 gSystem->Load(
"libTable");
27 TString pathName =
"$ROOTSYS/tutorials/cernstaff.dat";
28 gSystem->ExpandPathName(pathName);
29 if (gSystem->AccessPathName(pathName.Data()))
31 printf(
" Can not find file %s\n",pathName.Data());
34 FILE *fp = fopen(pathName.Data(),
"r");
42 while (fgets(&line,80,fp)) {
43 sscanf(&line[0] ,
"%d%d%d%d", &staff.cat,&staff.division,&staff.flag,&staff.age);
44 sscanf(&line[13],
"%d%d%d%d", &staff.service,&staff.children,&staff.grade,&staff.step);
45 sscanf(&line[24],
"%d%d%d", &staff.nation,&staff.hrweek,&staff.cost);
46 allStaff->
AddAt(&staff);
52 allStaff->
Print(0,10);
55 TFile *f =
new TFile(
"aptuple.root",
"RECREATE");
64 new TBrowser(
"staff",allStaff);
67 TCanvas *canva =
new TCanvas(
"Staff",
"CERN Population",600,600);
75 gStyle->SetHistFillColor(10);
76 gStyle->SetHistFillStyle(3013);
78 allStaff->Draw(
"age");
81 allStaff->Draw(
"cost");
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
virtual Int_t AddAt(const void *c)
virtual Char_t * Print(Char_t *buf, Int_t n) const
Create IDL table defintion (to be used for XDF I/O)
virtual Int_t Purge(Option_t *opt="")
Shrink the table to free the unused but still allocated rows.