Guidance
指路人
g.yi.org
Guidance Forums / Rapid-Q Basic / Remove section using QINI

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Remove section using QINI
#652
Posted by: 2002-11-11 17:13:28
Hi.

I'm playing around with QINI and I have no problems adding segments adding strings modifying values.. but when it comes to removing things i just can't figure it out.. anyone else who have any information about this?

Thnx..
Message2. Re: Remove section using QINI
#653
Posted by: guidance 2002-11-11 17:34:17
Does writing a null string work?
Message3. Re: Remove section using QINI
#654
Posted by: 2002-11-11 22:03:23

Yes. that works for individual parameters. For example

[test]
param1=1
param2=1
param3=1
param4=1
param5=1

I can remove the 'paramx' but what about the section [test]..

Tnx.
Message4. Re: Remove section using QINI
#655
Posted by: guidance 2002-11-12 07:26:49
Since .INI is a simple text file, we may manually remove the whole section:

1) Search string "[section name]" from the whole INI file and get the start position p1.
2) Search "[" from p1 to get the start of the next section p2. If it's the last section, it should be the length of file.
3) Replace the string between p1 to p2 by null.

Note [ and ] can not appear in parameter name or value. Otherwise you must escape them, for example, "L" for "[" and "R" for "]" etc.

You may contact the QINI author to update it by this algorithm :)
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sun 2022-9-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0