ini文件是windows的系统配置文件, 被用来对操作系统或特定程序初始化或进行参数设置. 在Windows系统中,INI文件是很多,最重要的就是“System.ini”、“System32.ini”和“Win.ini”。该文件主要存放用户所做的选择以及系统的各种参数。用户可以通过修改INI文件,来改变应用程序和系统的很多配置。

 

中间的数据格式一般为:

;注释(Comments)

[Section1 Name]
KeyName1=value1
KeyName2=value2
...

[Section2 Name]
KeyName1=value1
KeyName2=value2

ini 文件可以分为几个 Section,每个 Section 的名称用 [] 括起来,在一个 Section 中,可以有很多的 Key,每一个 Key 可以有一个值并占用一行,格式是 Key=value,注释以分号";"开头。

Windows提供了几个有用的API来读写操作INI文件:

  GetPrivateProfileString - 从 ini 文件的某个 Section 取得一个 key 的字符串
  GetPrivateProfileSection - 从 ini 文件中读出整个 Section 的内容
  WritePrivateProfileSection - 将一个整个 Section 的内容入 ini 文件的指定 Section 中
  WritePrivateProfileString - 将一个 Key 值写入 ini 文件的指定 Section 中

 

Visual basic 6读写ini文件
Visual basic 6读写ini文件
'declarations for working with Ini files
End Sub

 

相关文章:

  • 2022-01-12
  • 2021-10-10
  • 2021-12-30
  • 2021-06-06
  • 2021-06-28
  • 2022-03-04
猜你喜欢
  • 2022-12-23
  • 2021-06-20
  • 2021-05-22
相关资源
相似解决方案