This topic is now archived and is closed to further replies.


put and getting info in a .INI file

Recommended Posts

An .INI file is just like any other text oriented file (.TXT, etc). The only difference is the file extension. Don't think of the file extension as the part that decides the file content. It's the file format, if any, that matters. I hope I am saying that correctly.

Look up the streaming libs in C++, or if you are using C, the standard I/O libs. If you are using another language, then I can't really help you.

If you wanted to store information in an .INI file, go right ahead. Write your text or binary information to the file. The only thing that matters now, is to be able to read it correctly. If you are storing simple information in it, you could get away without a huge parser. You could just read the information in, assuming you knew the "format" to how you wrote it out.

If you want something like the C&C games use, you will need to spend some time programming a parser to read the information and decide what to do with it. This way, your .INI files could be more of a "programming language", or a better term, a "scripting language". If this is what you want, look up script parsers and such on Google.

Writing and reading to a .INI file is no different than writing or reading a .TXT file, a .BMP file, or even a .EXE file. The extension might be used to associate the file to a certain program, but really what matters is how your program reads and writes to your file, file extension doesn't really matter.

I hope that helps. Good luck.


[edited by - khaos on September 1, 2002 11:17:10 PM]

Share this post

Link to post
Share on other sites