Does VC.NET have an INI file class?

F

Fred Hebert

In order to maintain compatibility with some older software I need to be
able to read and write a classic ini type file. I don't see anything like
that in VC.NET. The old code looks something like this:

TIniFile *INI;
INI = new TIniFile("MyApp.ini");
Timeout = INI->ReadString("DEFAULTS","Timeout","10");
delete INI;

Before I go writing my own, I thought I'd ask.
 
F

Fred Hebert

You may want to look at this:

http://www.codeproject.com/cpp/CIni.asp

BTW, why do you create INI on the heap in your example?

This is a fragment from some legacy code that I am attempting to convert to
..NET. It is part of an example program that shows how to use a 3rd party
DLL, and is giving me fits.

I downloaded the CIni code/example but can't seem to get it to work
properly. I think mostly it's MFC/.NET differences.

Code from example that works:
m_sDelimiter = ini.GetString(_T("Settings"), _T("Delimiter"), _T(","));

My code:
IpEdit->Text = ini.GetString(_T("DEFAULTS"),_T("IpAddress"),_T
("10.1.1.1"));

Compiler complains that CIni::GetString function does not take 3 arguments.
Obviously a bogus error, but why?

I didn't think going to .NET was going to mean starting over with
programming 101, but it seems that everything I want do do, and used to be
easy, is just so difficult.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top