# Multiple Write Options

**URL:** <https://root-forum.cern.ch/t/multiple-write-options/33128>\
**Category:** Newbie\
**Created:** [March 13, 2019, 12:47am UTC](https://root-forum.cern.ch/t/multiple-write-options/33128 "2019-03-13T00:47:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcorrado](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/54ee81/32.png) [@jcorrado](https://root-forum.cern.ch/u/jcorrado)\
**Post date:** [March 13, 2019, 12:47am UTC](https://root-forum.cern.ch/t/multiple-write-options/33128/1 "2019-03-13T00:47:17Z")

</div>

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.

Thanks,  
Joseph

---

<div class="post-metadata">

**Author:** ![StephanH](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@StephanH](https://root-forum.cern.ch/u/StephanH)\
**Post date:** [March 13, 2019, 8:54am UTC](https://root-forum.cern.ch/t/multiple-write-options/33128/2 "2019-03-13T08:54:44Z")

</div>

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:

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

```

---

<div class="post-metadata">

**Author:** ![jcorrado](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/54ee81/32.png) [@jcorrado](https://root-forum.cern.ch/u/jcorrado)\
**Post date:** [March 13, 2019, 10:24am UTC](https://root-forum.cern.ch/t/multiple-write-options/33128/3 "2019-03-13T10:24:17Z")

</div>

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.

Best,  
Joseph

---

<div class="post-metadata">

**Author:** ![StephanH](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@StephanH](https://root-forum.cern.ch/u/StephanH)\
**Post date:** [March 18, 2019, 1:53pm UTC](https://root-forum.cern.ch/t/multiple-write-options/33128/4 "2019-03-18T13:53:18Z")

</div>

Glad being able to help.
