RE: [ROOT] How to use std::ifstream in ROOT?

From: Philippe Canal (pcanal@fnal.gov)
Date: Fri Jun 06 2003 - 23:18:19 MEST


Hi,

You should be able to compile using the following changes:

Cheers,
Philippe

diff -b evnt2root.orig evnt2root.C
48c48
<   ifstream idx_in("event_index.txt", ios::in);
---
>    ifstream idx_in("event_index.txt", std::ios::in);
55c55
<   ULong_t  blkCount,itmp;  // Block count and temporary ULong_t variable
---
>    UInt_t  blkCount,itmp;  // Block count and temporary ULong_t variable
71c71
<     evnt_in.open(evnt_fn,ios::in | ios::binary);  // open an event file to
read
---
>       evnt_in.open(evnt_fn, (std::ios::in | std::ios::binary) );  // open
an event file to read
74c74
<     evnt_in.read(&itmp,1);  // read file format sign: 4 bytes
---
>       evnt_in.read((char*)&itmp,1);  // read file format sign: 4 bytes
84c84
<       evnt_in.read(&evType,sizeof(unsigned short)*1); // Read evnt type
---
>          evnt_in.read((char*)&evType,sizeof(unsigned short)*1); // Read
evnt type
86c86
<       evnt_in.read(&evSize,sizeof(unsigned short)*1); // Read evnt size
---
>          evnt_in.read((char*)&evSize,sizeof(unsigned short)*1); // Read
evnt size
92c92
<       evnt_in.read(&blkCount,sizeof(unsigned long)*1); // Read block count
---
>          evnt_in.read((char*)&blkCount,sizeof(unsigned long)*1); // Read
block count
96c96
<       for(int i=0;i<blkCount;i++) {
---
>             for(unsigned int i=0;i<blkCount;i++) {
100c100
<           evnt_in.read(&itmp,sizeof(unsigned long)*1);
---
>                   evnt_in.read((char*)&itmp,sizeof(unsigned long)*1);
116a117
>             }
119d119
<       }

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Exaos Lee
Sent: Thursday, May 29, 2003 9:20 PM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] How to use std::ifstream in ROOT?


Dear ROOTers,
I cannot compile the attachment. And it cannot be interpreted by ROOT
correctly. I use string, ifstream here. What's wrong with it?

Regards


#################################################################
#################################################################
#################################################################
#####
#####
#####
#################################################################
#################################################################
#################################################################



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET