# Save after setting histogram bin

**URL:** <https://root-forum.cern.ch/t/save-after-setting-histogram-bin/51206>\
**Category:** Newbie\
**Created:** [August 15, 2022, 9:57pm UTC](https://root-forum.cern.ch/t/save-after-setting-histogram-bin/51206 "2022-08-15T21:57:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abunka](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/d6d6ee/32.png) [@abunka](https://root-forum.cern.ch/u/abunka)\
**Post date:** [August 15, 2022, 9:57pm UTC](https://root-forum.cern.ch/t/save-after-setting-histogram-bin/51206/1 "2022-08-15T21:57:49Z")

</div>

Hello all, this one should be pretty basic.  
I can’t seem to get a histogram change to stick:

```auto
root [0] TFile *_file0 = TFile::Open("file.root")
(TFile *) 0x408e8d0
root [1] hJetPT->GetBinContent(17)
(double) 11.000000
root [2] hJetPT->SetBinContent(17, 4.076e-13)
root [3] hJetPT->GetBinContent(17)
(double) 4.0760000e-13
root [4] .q
[user@lxplus746 home]$ root

root [0] TFile *_file0 = TFile::Open("file.root")
(TFile *) 0x4052530
root [1] hJetPT->GetBinContent(17)
(double) 11.000000
root [2]

```

I thought I had read in the primer that the files would save and update automatically on ending the session, but the bin content has not been saved. What should I do?  
Thanks!

---

<div class="post-metadata">

**Author:** ![dastudillo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dastudillo/32/17280_2.png) [@dastudillo](https://root-forum.cern.ch/u/dastudillo)\
**Post date:** [August 16, 2022, 12:05am UTC](https://root-forum.cern.ch/t/save-after-setting-histogram-bin/51206/2 "2022-08-16T00:05:20Z")

</div>

You need to [open](https://root.cern/doc/master/classTFile.html#ad0377adf2f3d88da1a1f77256a140d60) the file with the “update” option, and then write it before quitting.

```auto
TFile *_file0 = TFile::Open("file.root","update");
//...
_file0->Write();

```
