How to read a data file in ROOT on windows 10?

Dear all,

I’d like to know how reading a file works on Windows with ROOT?
Also, I wonder if visual studio 2019 or visual studio code can be linked to ROOT, so my codes use ROOT as a compiler. I currently use all separately. I use root on terminal standalone at the moment on Windows.
Note that, I used to run ROOT on linux. Thus, I am trying to familiarize myself for windows 10.

I attach one my codes which runs in Linux, but not on Windows at the moment because it cannot find the files when reading.
I attach the error on my Windows terminal.


EnamicData.root (543 Bytes)
EnamicData.txt (18 KB)
FindFittingValues.cpp (8.3 KB)

Sincerely Yours.

in.open(address1.c_str());

Thanks, I figured that part out. However, I cannot open a txt file full of counts to create an histogram.

Is this line of writing correct as an address for Windows to get the file?

Line: C:\Users\Spyhunter\Desktop\EnamicData.txt

If one code worked before in Linux, it should also work in windows after changing the paths like above, right?

Why this simple line doeesn’t work in windows?
Assume that here my file has 2 columns.
TGraph MyGraph = new TGraph(“C:\Users\Spyhunter\Desktop\EnamicData.txt”);
MyGraph->Draw("A
");

Try to replace every “\” with “\\”.

2 Likes

Perfect. I didn’t know path works like that on Windows.
Cheers.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.