Page 1 of 1 1
Topic Options
#121327 - 2004-06-16 06:37 AM Remove a KEY in INI file
NewScripter Offline
Fresh Scripter

Registered: 2002-05-01
Posts: 9
Hi,

I am wondering if there's a way to remove a KEY in an INI file. I can use WriteProfileString() to modify the VALUE of a KEY, but I want to completely remove the KEY.

Thanks!

Top
#121328 - 2004-06-16 09:34 AM Re: Remove a KEY in INI file
Pierre FREMION Offline
Getting the hang of it

Registered: 2000-01-11
Posts: 66
Loc: Paris, France, Europe, Sun3
Hi

Take a good look at writeprofilestring parameters.

If the 4th argument is '' (the empty string) the key is deleted.

If the 4th argument an the 3rd argument are '' the entire section given by the 2nd argument is deleted.

Remember that the strings for the file, section and key name aren't case sensitive.

Hope this helps.

Pierre
_________________________
Comments always welcome. French native so I apologize for my (mis)use of English!

Top
#121329 - 2004-06-16 11:46 AM Re: Remove a KEY in INI file
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and simple:
writeprofilestring("c:\stuff\myfile.ini","","","")

trashes the whole file :P
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.05 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org