Need help with simple root to text file command

Hello, I used to use the below command to extract root data and write to a text file. My computer got wiped and I got the latest version of root and it does not work anymore. I am not great with C language so if anyone could revise the command for me I would appreciate it so much.

TFile *f = TFile::Open(“ALL1_10nm5fc.root”); TH1D *h2 = (TH1D *)f->Get(“1”); h2->Print(“all”); > h2.txt

ROOT Version: v6.16.00
Platform: windows 7
Compiler: visual studio 2017

I am trying to extract 1;1 and have it written as text file with x,y

root[0] TFile *f = TFile::Open("ALL1_10nm5fc.root"); 
root[1] TH1D *h2 = (TH1D *)f->Get("1"); 
root[2] .> h2.txt

Thank you for your reply! When I copy and paste your answer I get the following error.

You should not copy the prompts. I put them to show you it’s a multiline process.
Copy/paste the following:

TFile *f = TFile::Open("ALL1_10nm5fc.root"); 
TH1D *h2 = (TH1D *)f->Get("1"); 
.> h2.txt

I did try it without the root before without success. I tried copy and paste your answer and I still get an error. I solved it by just downloading root5 instead of root6. I would like to solve it though still.

in case everything else fails, you could either use root-dump or root2yoda (2 binaries from GoHEP.)