# Converting root histogram to text file

**URL:** <https://root-forum.cern.ch/t/converting-root-histogram-to-text-file/34556>\
**Category:** Newbie\
**Created:** [June 12, 2019, 4:03pm UTC](https://root-forum.cern.ch/t/converting-root-histogram-to-text-file/34556 "2019-06-12T16:03:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanchitsharma](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/439d5e/32.png) [@sanchitsharma](https://root-forum.cern.ch/u/sanchitsharma)\
**Post date:** [June 12, 2019, 4:03pm UTC](https://root-forum.cern.ch/t/converting-root-histogram-to-text-file/34556/1 "2019-06-12T16:03:46Z")

</div>

I am using below commands to convert my histogram to a text file.

```auto
$ root -l modules.root
DefaultDigitizer->cd();
my_detector->cd();
pixelcharge->Print("all"); > pixelcharge.txt

```

The last line gives me two errors:

root [5] pixelcharge-\>Print(“all”); \> pixelcharge.txt  
ROOT\_prompt\_5:1:28: error: expected expression  
pixelcharge-\>Print(“all”); \> pixelcharge.txt

ROOT\_prompt\_5:1:30: error: use of undeclared identifier ‘pixelcharge’  
pixelcharge-\>Print(“all”); \> pixelcharge.txt

I am new to root can you please help me out on this?

Thanks!

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [June 12, 2019, 4:09pm UTC](https://root-forum.cern.ch/t/converting-root-histogram-to-text-file/34556/2 "2019-06-12T16:09:03Z")

</div>

In ROOT 6 you need:

```auto
.> pixelcharge.txt
pixelcharge->Print("all");
.>

```
