# Dump contents of a tree to an ASCII file

**URL:** <https://root-forum.cern.ch/t/dump-contents-of-a-tree-to-an-ascii-file/8652>\
**Category:** ROOT\
**Created:** [July 16, 2009, 11:55pm UTC](https://root-forum.cern.ch/t/dump-contents-of-a-tree-to-an-ascii-file/8652 "2009-07-16T23:55:05Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [July 17, 2009, 3:18am UTC](https://root-forum.cern.ch/t/dump-contents-of-a-tree-to-an-ascii-file/8652/2 "2009-07-17T03:18:59Z")

</div>

Hi,

Note that you can ‘almost’ get what you needed with maximum efficiency by doing:

```auto
########################################## 
# Read and dump the tree entries 
########################################## 
t.GetPlayer().SetScanRedirect(kTRUE) # You may have to cast t.GetPlayer() to a TTreePlayer*
t.GetPlayer().SetScanFileName("output.txt")
t.Scan("*")

```

Cheers,  
Philippe.

---

_[View the full topic](https://root-forum.cern.ch/t/dump-contents-of-a-tree-to-an-ascii-file/8652)._
