比較項目 | INIファイル | レジストリ |
---|---|---|
バイナリデータの扱い | ×*1 | ○ |
マルチユーザ対応 | ×*2 | ○ |
ファイルサイズ制限 | ×(あり32K?)*3 | ○なし |
データ移動のしやすさ | ○ | × |
編集のしやすさ | ○ | × |
バックアップのしやすさ | ○ | × |
操作失敗時のOSへの影響 | ○なし | ×あり |
[AppName] Font={MS Sans Serif} 8 Geometry=486x318+132+150 |
package require inifile pack [text .text] # 書き込みモードでオープン set ini [::ini::open sample.ini w] # セクションにキーと値を設定する ::ini::set $ini AppName Geometry [wm geometry .] ::ini::set $ini AppName Font [.text cget -font] # Diskへの書き込み(必須) ::ini::commit $ini # クローズ ::ini::close $ini |
package require inifile # 読み込みモードでオープン set ini [::ini::open sample.ini r] # セクションのキーから値を取る if {::ini::exists $ini AppName Geometry} { set geometry [::ini::value $ini AppName Geometry] } if {::ini::exists $ini AppName Font} { set font [::ini::value $ini AppName Font] } # クローズ ::ini::close $ini |