Multiple Write Options

I want to use TObject::kOverwrite and TObject::kSingleKey (or TObject::kWriteDelete) at the same time. I’m not quite sure how to pass both of these into the call to Write at the same time. I want to write a TObjArray of TEfficiency objects to file, and every time I run the macro I would like it to overwrite the previous TObjArray.


Hello Joseph,

I don’t have time to test it, but they are bits. So there is a good chance that an OR of the bits will do what you want:

...Write(...., TObject::kOverwrite | TObject::kSingleKey)

Hi Stephan,

Thank you for your swift reply! I saw that inside TObject the options are part of an enum and correspond to BIT, I just had no idea how to union BIT types. That did indeed work! My objects were overwritten to file with a single key for each TObjArray. Thank you.


Glad being able to help.