User | Post |
Darth Coby
Posts: 286/1371 |
Originally posted by Tuvai Disch, the settings I'm talking about are mostly boolean values and 2, maybe later 3 strings, I don't really think speed is an issue here.
Anyway, I got ini reading and writing working now. I found a script online (though I got it cropped to like, 5 times as small ).
Well yeah, they're only there to point you in the right direction. |
Tuvai
Posts: 121/211 |
Disch, the settings I'm talking about are mostly boolean values and 2, maybe later 3 strings, I don't really think speed is an issue here.
Anyway, I got ini reading and writing working now. I found a script online (though I got it cropped to like, 5 times as small ). |
Dish
Posts: 13/596 |
I prefer binary ".dat" files anyway. Less string formatting, smaller file size, less work to read/write, and faster. Only downside is that the user can't really edit them in a text editor... but then again, that's what your program's interface is for. |
Darth Coby
Posts: 246/1371 |
Originally posted by dan This probably doesn't apply with your case, but with those API calls, there's a 65k limitation on the size of the INI file. I ran into it a few times when using Visual Basic.
But then you could create your own routine instead of using an API. |
dan
Posts: 21/782 |
This probably doesn't apply with your case, but with those API calls, there's a 65k limitation on the size of the INI file. I ran into it a few times when using Visual Basic. |
Dish
Posts: 12/596 |
I don't know about VB... but in C++:
WritePrivateProfileString("Section","ItemName","Value","C:\\pathname\\file.ini");
would appear as:
[Section] ItemName=Value
In the file at the specified path (C:\pathname\file.ini)
To read, you would do:
GetPrivateProfileString("Section","ItemName","DefaultValue",pointertostring,sizeofstring,"C:\\pathname\\file.ini");
DefaultValue is used if the Item does not appear in the ini file. 'pointertostring' is a string which receives the data... and 'sizeofstring' is the size of the string buffer.
Granted... VB probably does this differently, but I believe these functions are WinAPI calls, so VB should be able to access them in one form or another. Just search for those function names on MSDN or something. |
Tuvai
Posts: 118/211 |
Well, those would help if they weren't huge source codes for stuff more than just ini file storing of which I don't understand most anyway. |
Darth Coby
Posts: 241/1371 |
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=28349&lngWId=1
and http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=6138&lngWId=1 Those are pretty good ones, I can't find the one I once used anymore though. |
Tuvai
Posts: 117/211 |
Ah, yes, I meant INI files, not INF. I don't know why I keep sayingand typing INF since I never work with them. |
Darth Coby
Posts: 235/1371 |
If INF reading/writing is the same as INI reading/writing then you'll have to use APIs. Check www.planet-source-code.com for that. |
Tuvai
Posts: 116/211 |
Oh yeah, forgot to mention that I don't want to use registry for this, anyway, I'll look through the page in that link you just posted. |
Jesper
Posts: 136/2390 |
http://www.vbcity.com/forums/faq.asp - tutorials for almost everything, including, I think, INF writing and registry doodads. |
Tuvai
Posts: 115/211 |
Well, topic title pretty much explains it all. I'm making a program right now but I came to the conslution that I haven't really been using any effective storage method yet (other then databases, but this program won't be using one).
I think an INF file will be ideal for this. The settings we're talking about are just simple yes/no (1/0) settings and a few, short text strings. So, anybody can give me a push on how to store and use these settings in an INF file? Oh yeah, obviously, I need a way to edit the INF file so I can edit the settings, too. |