TTree with branch as variable-length array of c-strings

I am attempting to use the TTree functionality of adding a variable-length array (as described in Example 2: A Tree with a C Structure in the User’s Guide chapter on trees) in order to store an array of C-strings. For some reason, the procedure that I am currently using only stores the first C-string (character array) in the array. Any tips on how to correct this procedure would be appreciated. A simple macro which demonstrates the procedure and duplicates the error is included.

[code]#include
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>

using namespace std;

void char_test(){
//open file and tree
TFile the_file(“testTree.root”,“RECREATE”);
TTree *the_tree = new TTree(“Output_Tree”,“Tree_1”);

//data
int n_str = 4;
string strs[4] = {“these”,“are”,“some”,“strings”};

//branch variables
string str_temp;
char chs[10][512];

//set up branches
the_tree->Branch(“nstr”,&n_str,“nstr/I”);
the_tree->Branch(“CharString”,chs,“CharString[nstr]/C”);

//fill in branches
for(int i=0;i<n_str;i++){
str_temp = strs[i];
sscanf(str_temp.c_str(),"%s",chs[i]);
}
the_tree->Fill();

//write and close file
the_file.Write();
the_file.Close();

}[/code]

Hi,

[quote]the_tree->Branch(“CharString”,chs,“CharString[nstr]/C”);[/quote]is not supported. Please use a std::vector or TClonesArray of TObjString instead.

Cheers,
Philippe.