Hi jan, Replace your while loop by: while (1) { fin >> rootfile; if(!fin.good()) break; cout << "Processing file: " << "*" << rootfile << "*" <<'\n'; } Rene Brun On Wed, 21 Aug 2002, Jan Conrad wrote: > > Hi, > > > > following MACRO: > > { > #include <fstream.h> > #include <iostream.h> > > char rootfile[1024], tmpfil[1024]; > TString FileList ="idiot.dat"; > ifstream fin(FileList); > > if (!fin){ > cout << "cannot open file list \n"; > return 1; > } > > // List of monitoring files. > > > > while (!fin->eof()) { > > fin >> rootfile; > cout << "Processing file: " << "*" << rootfile << "*" << > '\n'; > > } > cerr << "Done" << '\n'; > > } > > > gives as output: > > Processing file: *1* > Processing file: *2* > Processing file: *3* > Processing file: ** > Done > > The file idiot.dat has the entries: > 1 > 2 > 3 > > and more idiot.dat|wc -l gives as answer: 3 (i.e it has really 3 > lines, the buffer ends after the 3) > > So why the additional ** output ? > > Thanks in advance, > > Jan Conrad > > > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > Jan CONRAD , ISV, HEPD, Uppsala University > Angstrom Laboratory, room 12145 > phone/fax:+46- 18-471 7639/3513 > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:05 MET