Reading from a ifstream

From: Frank Dropmann (fdr@axnhd0.mpi-hd.mpg.de)
Date: Mon Dec 29 1997 - 18:12:54 MET


Hi 

 The little function given below is supposed to 
 read some file names from a list (and later chain the 
 corresponding files in root) 
 The reading of the list works fine if compiled 
 outside root but when loaded in root and 
 run from the intepreter root crashes ! 

 A bug or just my C++/root  ignorance ? 

 Here the function : 


#include <fstream.h>
#include <iostream.h>

void FileChain(const char *filename=0)
{

  char Buf[256];
  char c;
  
  ifstream  List(filename);
  if (!List){  cerr << " cannot open " << filename ; }
  else {  
    while(List.get(Buf,256,'\n'))
	  {  cout << Buf << '\n' ; 
          if (List.get(c) && c!='\n') { cout << "error : line truncated" ;}  
      }
  }
}


 

 

 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:23 MET