Hi rooters, I am putting together an output module that writes large amounts of data in a TTree. I want to check for error conditions (like a disk that fills up). Looking at the signature of TTree::fill(), that returns an int with the number of bytes written, I was assuming that an error condition would have been flagged returning 0 or a negative number. Not so! That's what I get: ..... SysError in <TFile::WriteBuffer>: error writing to file data93/calaf//DIMblock_1/small2_stream_941832479_temp_0 (No space left on device) SeqRootDiskFile::write: bytes written 23019 ..... this goes on till the end of the job, the files are closed properly and if you don't look at the logs you'll never notice that something went wrong! This is how I understand what's happening: TFile::WriteBuffer sees the error condition, prints an error message and returns an error code. But the error code is ignored by the intermediate level in TBasket class so TTree::fill doesn't have a clue that something is wrong. There is some logic into that: TTree::fill() is not writing to disk but into the memory buffer so strictly speaking the error is not its business. Having said that, what can the poor programmer do if he wants to handle this error? If, for example, there were a TFile error condition flag (a sort of errno) that I could check before filling the tree, I could disable writing to the faulty stream or simply stop the job with an error code... Any suggestion? Paolo Calafiura
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:42 MET