# TParameter for string?

**URL:** <https://root-forum.cern.ch/t/tparameter-for-string/11529>\
**Category:** ROOT\
**Created:** [December 11, 2010, 10:39pm UTC](https://root-forum.cern.ch/t/tparameter-for-string/11529 "2010-12-11T22:39:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![crgg](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/e79b87/32.png) [@crgg](https://root-forum.cern.ch/u/crgg)\
**Post date:** [December 11, 2010, 10:39pm UTC](https://root-forum.cern.ch/t/tparameter-for-string/11529/1 "2010-12-11T22:39:25Z")

</div>

Hi Rooters,

Is there something like a TParameter?  
I’m already using TParameter to safe some values in a TFile.  
In addition to that I would like to safe a string as well.  
Does anyone have an idea on how to do that?

Cheers,

Christian

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [December 13, 2010, 7:22pm UTC](https://root-forum.cern.ch/t/tparameter-for-string/11529/2 "2010-12-13T19:22:56Z")

</div>

Hi Christian,

You could use TObjString …

Philippe.

---

<div class="post-metadata">

**Author:** ![crgg](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/e79b87/32.png) [@crgg](https://root-forum.cern.ch/u/crgg)\
**Post date:** [December 14, 2010, 9:16am UTC](https://root-forum.cern.ch/t/tparameter-for-string/11529/3 "2010-12-14T09:16:40Z")

</div>

Hello Philippe,  
thanks for your answer.

TObjString looks like a interesting option. The problem is that TObjString doesn’t have a name.  
The string in the object is used as name and value.

In my case I wanted to safe the version of the software which created the root file in the file it self.  
Therefore I wanted to create an object with the name “version” and a string value.  
Unfortunately this is not possible for TObjString.

Are there any other options to save a sting value with a name in a TFile?

Thanks for the help

Christian

---

<div class="post-metadata">

**Author:** ![brun](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/b9e5f3/32.png) [@brun](https://root-forum.cern.ch/u/brun)\
**Post date:** [December 14, 2010, 10:08am UTC](https://root-forum.cern.ch/t/tparameter-for-string/11529/4 "2010-12-14T10:08:20Z")

</div>

use TNamed

Rene

---

<div class="post-metadata">

**Author:** ![crgg](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/e79b87/32.png) [@crgg](https://root-forum.cern.ch/u/crgg)\
**Post date:** [December 14, 2010, 3:55pm UTC](https://root-forum.cern.ch/t/tparameter-for-string/11529/5 "2010-12-14T15:55:50Z")

</div>

Hi Rene,  
thanks for your answer.  
This is exactly what I was looking for.  
Regards,  
Christian

---

<div class="post-metadata">

**Author:** ![yus](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/9fc348/32.png) [@yus](https://root-forum.cern.ch/u/yus)\
**Post date:** [December 1, 2025, 2:08pm UTC](https://root-forum.cern.ch/t/tparameter-for-string/11529/6 "2025-12-01T14:08:02Z")

</div>

Hi,  
I know this is a 15-year-old thread, but I would be very interested to know how a string used as a `TNamed` can be saved into a `TParameter`.

Thanks!

---

<div class="post-metadata">

**Author:** ![yus](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/9fc348/32.png) [@yus](https://root-forum.cern.ch/u/yus)\
**Post date:** [December 2, 2025, 9:59am UTC](https://root-forum.cern.ch/t/tparameter-for-string/11529/7 "2025-12-02T09:59:04Z")

</div>

Answering my own question: I realized that yesterday I misunderstood the suggestion in this topic. I mistakenly thought the idea was to put a string into a `TNamed` and then to create a `TParameter` with this `TNamed` inside. But what René was really suggesting was to use a `TNamed` **instead of** `TParameter`. Indeed, this works in `python`:

```auto
myString = "ROOT 6.32.08"
tn_myString = ROOT.TNamed("tn_myString", myString)
tn_myString.Write()

```
