Umnik Posted January 6, 2010 Share Posted January 6, 2010 Hello! Please share an example of reading the program settings from ini file. I would be grateful for any example, thank you! Quote Windows 7 Ultimate x64bit / Intel Core 2 Quad Q8400 / 4GB DDR2 SDRAM / GeForce 8800 GTS Resource War Developer [ dev blog ] Link to comment Share on other sites More sharing options...
Pixel Perfect Posted January 6, 2010 Share Posted January 6, 2010 I don't know what language you are using with Leadwerks but there are many free libraries available in C++ for reading and writing to ini files and I'd be almost certain that some must exist for BlitzMax too. This would probably be the easiest route. Failing that you could always write your own parser to read in the file and write it out again if need be. [Edit] Just noticed this post is in the C++ forum so I guess that's answered that Here is a link to one I've used successfully in the past: INI File Lib Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Roland Posted January 6, 2010 Share Posted January 6, 2010 C++ WriteProfileString GetProfileString 1 Quote AV MX Linux Link to comment Share on other sites More sharing options...
Umnik Posted January 6, 2010 Author Share Posted January 6, 2010 Thanks! This work sample: #include <windows.h> #include <stdio.h> int main() { int WindowWidth, WindowHeight; WindowWidth = GetPrivateProfileInt (TEXT("GRAPHICS"), TEXT("Width"), 0, TEXT(".//setting.ini")); WindowHeight = GetPrivateProfileInt (TEXT("GRAPHICS"), TEXT("Height"), 0, TEXT(".//setting.ini")); printf ("Key: %i\n", WindowWidth); printf ("Key: %i\n", WindowHeight); return(1); } setting.ini [GRAPHICS] Width=800 Height=600 Suddenly, someone will need ... Quote Windows 7 Ultimate x64bit / Intel Core 2 Quad Q8400 / 4GB DDR2 SDRAM / GeForce 8800 GTS Resource War Developer [ dev blog ] Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.