Hi, There is a slight problem in cint 5.15.123 with the handling of the typedef Double_t. Cast to a double before sending to a stream (or use double instead of Double_t) output << " " << (double)table[i][k]; Cheers, Philippe. -----Original Message----- From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of cstrato Sent: Saturday, February 21, 2004 2:35 PM To: roottalk@pcroot.cern.ch Subject: [ROOT] Problem exporting table from CINT Dear Rooters The following macro exports the correct table when called from CINT as TestTable(0). However, calling TestTable(3) exports the following table: 0x1 0x2 0x3 0x3 0x1 0x2 0x3 0x4 0x1 0x2 0x3 0x5 In contrast, compilation with ACLiC gives the correct result for TestTable(3): 1.1 2.2 3.3 3 1.1 2.2 3.3 4 1.1 2.2 3.3 5 Is there a hidden problem in my code or is this a problem of CINT? My system is ROOT 4.00/02 (1.Feb 20) on MacOS X 10.3.1. Best regards Christian _._._._._._._._._._._._._._._._ C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a V.i.e.n.n.a A.u.s.t.r.i.a _._._._._._._._._._._._._._._._ //__________________________________________________________________________ ____ void TestTable(Int_t cut = 0) { ofstream output("test.txt", ios::out); Int_t nrows = 6; Int_t ncols = 4; // Create table Double_t **table = 0; if (!(table = new Double_t*[nrows])) {goto cleanup;} for (Int_t i=0; i<nrows; i++) { table[i] = 0; if (!(table[i] = new Double_t[ncols])) {goto cleanup;} }//for_i // Fill table for (Int_t i=0; i<nrows; i++) { for (Int_t k=0; k<ncols; k++) { table[i][k] = (k==ncols-1) ? i : (k+1)*1.1; // table[i][k] = i; }//for_k }//for_i // Export table for (Int_t i=0; i<nrows; i++) { if (cut > 0 && (Int_t)(table[i][ncols-1]) < cut) continue; for (Int_t k=0; k<ncols; k++) { output << " " << table[i][k]; }//for_k output << endl; }//for_i // Cleanup cleanup: for (Int_t i=0; i<nrows; i++) { if (table[i]) {delete [] table[i]; table[i] = 0;} }//for_i if (table) delete [] table; output.close(); }//TestTable ################################################################# ################################################################# ################################################################# ##### ##### ##### ################################################################# ################################################################# #################################################################
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET