?
Solved

Dll to load ini information

Posted on 2003-03-10
7
Medium Priority
?
269 Views
Last Modified: 2008-02-01
I'm trying to load the data from ini file.

I want to store the data in ini file like this:

[HeaderNeeded]
File1=true
File2=true


I have about 10 different DLL with their own configurations.  Some of the DLL split the raw data into two files, along with the header line on each file. Other do just make an output file.

I want to make the master program more generic, so creating new dll will simply interface with the master program.  

The situation is that TIniFiles class is a VCL class, which DLL cannot use. I'm trying to find the other way.

These File1 and File2 are being updated very frequently as the interpretation being processed.

Once the either File1 or File2 have a bool value of false, the header line will not be created.

Can anyone help?
0
Comment
Question by:Blubbo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 6

Accepted Solution

by:
Mafalda earned 152 total points
ID: 8109953
Did you try to use the registry instead of INI files  ?
0
 
LVL 58

Assisted Solution

by:Julian Hansen
Julian Hansen earned 148 total points
ID: 8110757
Maybe I missed something but what is wrong with using the GetPrivateProfile functions

GetPrivateProfileString / WritePrivateProfileString
GetPrivateProfileInt / WritePrivateProfileInt

?
0
 

Expert Comment

by:mabotta
ID: 8112569
Hello,
For managing ini files I'm using a class with a map object, like map<string, string> and reading the file like a text file, so I can port it to another os.
In your case, the map would be load like this:

map<string, boolean> iniData;

iniData["HeaderNeeded.File1"] = true;
iniData["HeaderNeeded.File2"] = true;

I hope it would be usefull
bye
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:Mafalda
ID: 8113530
julianH,
You are not missing anything ...
The registry is another way to do it, while INI files functions were declared absolete for win32 applications and are kept for competability

From MSDN:
"GetPrivateProfileString
The GetPrivateProfileString function retrieves a string from the specified section in an initialization file. This function is provided for compatibility with 16-bit Windows-based applications. Win32-based applications should store initialization information in the registry."


By the way if you read about the INI files functions  implementations you will see that they use  . . . the registry to locate the INI file ;o)

As I knoe MS using the INI file should be safe enough for many more years
0
 
LVL 58

Expert Comment

by:Julian Hansen
ID: 8114604
Ah, yes but INI files are sometimes used where it is not possible to use the registry. For instance when multiple applications / workstations need to access the same configuration information - which workstation's registry is the one that must contain the data. Obviously you could set values in the registry on each machine but that would be an administration nightmare - wouldn't it? If you want a central config file (in INI format) then the registry is not the way to go.

GetPrivateProfileXXX uses the registry to locate the INI file ????? So what is the last parameter (lpFileName)for then? If you use the GetProfileXXX funtions i.e. without the Private part then yes the registry is used otherwise it is not.

My post was to find out why there is a need to use a complicated method for retrieving information from an INI file. Using the argument that you want to port other OS's is weak - if you can't implement the GetPrivateProfileXXX functions on other OS's you are still going to have to implement the map object so what is the difference?
0
 
LVL 11

Expert Comment

by:bcladd
ID: 9978951
No comment has been added lately, so it's time to clean up this TA. I will
leave a recommendation in the Cleanup topic area that this question is:

Answered: Points split between Mafalda and julianH

Please leave any comments here within the next seven days.

Experts: Silence means you don't care. Grading recommendations are made in light
of the posted grading guidlines (http://www.experts-exchange.com/help.jsp#hi73).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

-bcl (bcladd)
EE Cleanup Volunteer
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question