Most convenient way to edit a single string entry in a root file

Hi,

I need to change the value of a string stored as a TObjString in a root file.

File structure:

FileA:
- dir
    - valueInFile

My first idea was that this was a perfect use case for TBrowser, but it seems that this kind of editing is not possible. Manually editing the string through the root prompt (using valueInFile->String()(10) = 'x'; file->Write()) is also not possible, the updated value is not written to disk.

Is there a standard way doing a one-off edit of a single value in a TFile?

Cheers,
Kim

Sorry, but AFAIK, you can’t edit, but you can modify and save in another root file…

file->Write();

will only update the objects that are attached to the file, by default those are TTrees and Histograms. To store the TObjString you have to explicitly do so.

file->WriteObject( valueInFile );