Hi Exaos, This is not an unexpected results. Actually, using your method (struct + passing the string 'Name/C'), the tree has NO way to know the actual length of the character array. You should use 'Name[20]/C' instead (indicating the length). HOWEVER, the support for struct is inherently fragile (due to alignment issues and other weirdnesses). We strongly recomment using a compiled class to hold onto the data. See attached example. Note in particular how much simpler the Branch statement is and anytime you modification the class Person you will NOT have to also modify this branch statement, the information will be passed automatically. Cheers, Philippe. -----Original Message----- From: Exaos Lee [mailto:schlie@iris.ciae.ac.cn] Sent: Sunday, July 27, 2003 9:51 AM To: 'rootdev'; roottalk@pcroot.cern.ch Subject: [ROOT] A Bug of TTree::Fill() Dear rooter, Please check the attachment. I think it is a bug of TTree::Fill(). There are three files in the attachment: 1. data.txt -- Data file used for test 2. tree_01.C and tree_02.C are test macros. Start root, and execute the following commands: --- root [] .L tree_01.C root [] .L tree_02.C root [] fill_data_01("data.txt") root [] fill_data_02("data.txt") --- Please compare both outputs. If a structure contains a string member before members of other types (such as integer), TTree::Fill() cannot give the correct result. Because my English is limited, I hope I have indicate the problem clearly. Best regards. Exaos
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET