Reading from a ifstream

Frank Dropmann (fdr@axnhd0.mpi-hd.mpg.de)
Mon, 29 Dec 1997 18:12:54 +0100


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" ;}
}
}
}