PowerBuilder配置文件ini与操作方法
INI文件简介
开发人员可以在自己的应用中为用户保留它们的配置文件,给用户提供灵活的选择。PowerBuilder 的配置文件采用Windows 的ini 文件格式,由节、关键字和取值3 种元素构成。例如,下面代码是ini 文件中的一段:
[Database] DBMS=ODBC Database= UserId=DBA DatabasePassword= pass=sfsf [security] zl{}=~{mjwwu{儑
其中,在“[”和“]”之间的为节名称,各个“=”号左面的是关键字,右面是取值。上面文件中有两个节,“database”和“security”,各个节都有属于自己的关键字。有些关键字没有取值,这时使用默认值。
当使用“pass”时,读取口令的脚本语句为:
String ls_pass Ls_pass=ProfileString("rsgl.ini","security","pass","")
如何编辑INI
编辑INI文件需要用到几个函数,如下:
1、SetProfileString()
2、ProfileString()
3、ProfileInt()
4、filedelete()
6、FileOpen("rsgl.ini",StreamMode!, Write!, LockWrite!, Replace!)
7、fileclose()