この文書の現在のバージョンと選択したバージョンの差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
ja:root:tstring [2014/04/26 03:47] kota [LOOPで生成] |
ja:root:tstring [2018/02/06 07:21] (現在) kota [基本的な使い方] |
||
---|---|---|---|
ライン 9: | ライン 9: | ||
* やり方色々 | * やり方色々 | ||
<code c_mac> | <code c_mac> | ||
- | TString str("hoge"); //ありがち | + | TString str("hoge"); |
- | TString str = "hoge"; //こちらもありがち | + | TString str = "hoge"; |
TString str; //まず宣言してから | TString str; //まず宣言してから | ||
ライン 36: | ライン 36: | ||
cout << str.Data() << endl; | cout << str.Data() << endl; | ||
</code> | </code> | ||
- | * 上の2つの出力は同じ(hoge)。Data関数の意味は?よくわからん | + | * 上の2つの出力は同じ(hoge)。TString::Data()は Char_t* を返している。 |
ライン 49: | ライン 49: | ||
// hoge1.root と出力される | // hoge1.root と出力される | ||
+ | cout << Form("hoge%02d.root",1) << "," << Form("hoge%03d.root",1) << endl; | ||
+ | //フォーマット指定子のリーディングゼロの機能(0詰め)を使うと、 | ||
+ | //hoge01.root , hoge001.root と出力される | ||
</code> | </code> | ||
ライン 56: | ライン 59: | ||
* %f : float | * %f : float | ||
* %lf : double | * %lf : double | ||
+ | * %c : char (1文字) | ||
+ | * %s : char* , TString (文字列) | ||
+ | * %lld: Long64_t | ||
---- | ---- |