Error reading data from file

Hi.
I’m trying to read data from a file and store them into an array of histograms.
when I make the program run I got this message:

*** glibc detected *** /home/luca/root/root/bin/root.exe: free(): invalid next size (fast): 0x08e71730 ***

and a backtrace, and root quits.
The problem has to do with the reading part, not with filling the histograms.

The file I’m trying to read are 295800 lines like the one i attach.

thanks

Luca
oneline.txt (51 Bytes)
crash.C (795 Bytes)
spark.C (1.51 KB)

愛情萬歲
fly.C (926 Bytes)
glow.C (1.59 KB)

愛情萬歲 ? :slight_smile:

爱情万岁 :exclamation: :mrgreen:

Wow! Thanks a lot! now it works perfectly.
I’m not very skilled in programming, can you please tell me what was the problem, so that the next time I know how to do?

best

Luca

爱情万岁 :wink:
fly.C (1.1 KB)
glow.C (2.22 KB)

Thank you again for the help!

good work

Luca

P.S. by the way, what does the chinese (or japanese?) writing mean?

No idea, Pepe started it … ask him :slight_smile:

Dear Pepe. I realized that the reading/filling part behave strangely. infact a lot of bins seems to remain at the 0 value. I attach an image to show you. I’m trying to fix it, but if you know what can be the problem I’ll be grateful.

Luca


Check your txt data file - there might be problems in some lines that then result in 0s (for the lines that have problems).

Thanks Pepe. Looking at the file it seems not the case.
I’m trying to debug but if I insert the line

if(*entries = 0.) cout<<"!!!"<<*entries<<endl;

after each line reading in the for loop, then it doesn’t fill the first histogram (but fills the other). I don’t understand why

Luca

愛情萬歲
fly.C (1.27 KB)
glow.C (2.64 KB)

I had white lines in the data file.
thanks a lot

Luca