|
-
Mar 23rd, 2005, 05:08 AM
#1
Thread Starter
Lively Member
Executing code from a file [RESOLVED]
Some of you that play on Battle.net may be familiar with the famous bot written in VB6 called StealthBot. This bot shows a great example of what I would like to do. I would like to save information in a .ini file, and retrieve it later for use.
Saving the information is the easy part, tha'ts done. Onto retrieval. StealBot comes with a file called definitions.ini. In it is some word definitions (I suppose it's for an auto-correct feature or something) anywho, inside is some information that the program reads. Example:
Code:
[Def]
TacoBell=Pure greatness.
MadFrog=An angry frog.
3dFX's Mom=A dirty hoe
Everything that is under [Def] is known to the program as a definition, and the program does things accordingly to any info under it.
I want to know how to go about doing this. I am making a progam where I want it to take an ini file with information like seen here:
Code:
[Name]
Donna
Jeff
Sarah
[GPA]
2.0
4.0
1.5
I want to read all as text (so no need in converting the numbers to strings). The number of lines under [name] will change, as will the number of lines under GPA.
I know that it would be better (and probably easier) to save them as arrays, having an array for gpa and an array for name. But, how do I get only the information under [name] into the dimensions of name array etc.
Thank you for any help.
Last edited by deranged; Mar 23rd, 2005 at 05:39 AM.
-
Mar 23rd, 2005, 05:40 AM
#2
Thread Starter
Lively Member
Re: Executing code from a file [RESOLVED]
I have figured out how to do this. Both the read, and the write methods are API's
VB Code:
Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|