473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

getting named constant values from ini file


I want to get the numeric named constant value from an ini file. Basically
I want to translate a string data type into the named constant value it
represents.

For example - for SQL-Server replication the sql_merge dll has the following
constants for configuring the security mode:

DB_AUTHENTICATION, NT_AUTHENTICATION

These values are 0, 1 respectively.

If I setup my ini file as follows:

PublisherSecurityMode = NT_AUTHENTICATION

and then attempt to set my SQL_Merge PublisherSecurityMode value to this - I
get a "wrong data type" error since it takes this value as a string and not
as a named constant.

I have tried eval(NT_AUTHENTICATION) which doesn't work.

I would rather avoid putting integers in my ini file. Is there a standard
way of dealing with this?

Thanks much.......
Nov 13 '05 #1
2 2658
astro wrote:
I want to get the numeric named constant value from an ini file. Basically
I want to translate a string data type into the named constant value it
represents.

For example - for SQL-Server replication the sql_merge dll has the following
constants for configuring the security mode:

DB_AUTHENTICATION, NT_AUTHENTICATION

These values are 0, 1 respectively.

If I setup my ini file as follows:

PublisherSecurityMode = NT_AUTHENTICATION

and then attempt to set my SQL_Merge PublisherSecurityMode value to this - I
get a "wrong data type" error since it takes this value as a string and not
as a named constant.

I have tried eval(NT_AUTHENTICATION) which doesn't work.

I would rather avoid putting integers in my ini file. Is there a standard
way of dealing with this?

Thanks much.......

Your ini file should look like below. Your format of the ini file is not
a standard ini file format. A standard format is [Section] with
keywords= Value
after the section name.

[Section]
Keyword1 = Value1
Keyword2 = Value2

Look at any ini file in your windows directory.

[PublisherSecurityMode]
DB_AUTHENTICATION=0
NT_AUTHENTICATION=1

In my program I have a call of a function that return the data I want.
Dim cVersion As String
cVersion = Trim(GetINIFile(cPath, "Version", "ProgramVersion"))

cPath is the path to the ini file
Version is the section in the ini file
ProgramVersion is the Keyword in the Version section I want.
The call returns the value or a defaule value if ProgramVersion does not
exist.

Ron

--
Ronald W. Roberts
Roberts Communication
rw*@robcom.com

Nov 13 '05 #2
ahhhh.......

I will implement this.

Thanks.

"Ronald W. Roberts" <rw*@robcom.com> wrote in message
news:11*************@corp.supernews.com...
astro wrote:
I want to get the numeric named constant value from an ini file.
Basically I want to translate a string data type into the named constant
value it represents.

For example - for SQL-Server replication the sql_merge dll has the
following constants for configuring the security mode:

DB_AUTHENTICATION, NT_AUTHENTICATION

These values are 0, 1 respectively.

If I setup my ini file as follows:

PublisherSecurityMode = NT_AUTHENTICATION

and then attempt to set my SQL_Merge PublisherSecurityMode value to this -
I get a "wrong data type" error since it takes this value as a string and
not as a named constant.

I have tried eval(NT_AUTHENTICATION) which doesn't work.

I would rather avoid putting integers in my ini file. Is there a standard
way of dealing with this?

Thanks much.......

Your ini file should look like below. Your format of the ini file is not
a standard ini file format. A standard format is [Section] with keywords=
Value
after the section name.
[Section]
Keyword1 = Value1
Keyword2 = Value2

Look at any ini file in your windows directory.

[PublisherSecurityMode]
DB_AUTHENTICATION=0
NT_AUTHENTICATION=1

In my program I have a call of a function that return the data I want.
Dim cVersion As String
cVersion = Trim(GetINIFile(cPath, "Version", "ProgramVersion"))

cPath is the path to the ini file
Version is the section in the ini file
ProgramVersion is the Keyword in the Version section I want.
The call returns the value or a defaule value if ProgramVersion does not
exist.

Ron

--
Ronald W. Roberts
Roberts Communication
rw*@robcom.com

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
6
by: Danny Lesandrini | last post by:
I'm using an Access database to drive a web site and the colors of various table backgrounds are stored in Access. I want users of the Access database to be able to select colors for the site, but...
60
by: Mohd Hanafiah Abdullah | last post by:
Is the following code conformat to ANSI C? typedef struct { int a; int b; } doomdata; int main(void) { int x;
8
by: SStory | last post by:
How can I get value pairs of named colors and the color they represent? I want to easily get these colornames and then their associated color values into a file so I can add to the list and offer...
22
by: Ben Finney | last post by:
Howdy all, I've recently packaged 'enum' in PyPI. In its description, I make the claim that it creates "immutable" enumeration objects, and that the enumeration values are "constant" values. ...
3
by: Tuomas | last post by:
Hi! I am a PHP beginner, and I don't know my way around. Let's say I have a file named as "file.php". Is there a special variable that already includes the file name, or should I just manually code...
6
by: WT | last post by:
Hello, Using VS2005. I have an assembly library that can be called from a Web site asp.net application or from a winform application. From this library I need to retrieve a path using simply a...
3
by: Sin Jeong-hun | last post by:
Often, I need to call Windows APIs in C#. Signatures and macro constants can be easily found at MSDN but the constants values are not shown. I have to search the .h file for those constants values....
1
davydany
by: davydany | last post by:
Hey guys...a n00b Here for this site. I'm making a sequence class for my C++ class. And The thing is in the array that I have, lets say i put in {13,17,38,18}, when i see the current values for the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.