Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Topaz on August 24, 2005, 03:25 AM

Title: Deleting lines in an INI file
Post by: Topaz on August 24, 2005, 03:25 AM
Anyone know how to do this?
Title: Re: Deleting lines in an INI file
Post by: UserLoser. on August 24, 2005, 07:56 AM
WritePrivateProfileString (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/writeprivateprofilestring.asp)
Title: Re: Deleting lines in an INI file
Post by: Yegg on August 24, 2005, 08:38 AM
Or you could make your own function for this. You could append all lines (or characters) to an array and inside the array edit out any lines that you must. Then for each line (or character), write them back to the file.
Title: Re: Deleting lines in an INI file
Post by: MyndFyre on August 24, 2005, 10:13 AM
...which would probably be entirely less efficient than WritePrivateProfileString.
Title: Re: Deleting lines in an INI file
Post by: Warrior on August 24, 2005, 12:48 PM
Would also defeat the purpose of an INI file (prevent writing to a file yourself, as opposed to having settings which are editable whenenver)
Title: Re: Deleting lines in an INI file
Post by: Topaz on August 24, 2005, 01:02 PM
wtf, VB6 is telling me that Null is invalid, and yet it says I can do it in MSDN!

>confusion
Title: Re: Deleting lines in an INI file
Post by: MyndFyre on August 24, 2005, 01:33 PM
You should use 0 instead of vbNull and pass it as an integer.
Title: Re: Deleting lines in an INI file
Post by: UserLoser. on August 24, 2005, 02:40 PM
Or use vbNullString like you probably should be?