Solved

Does Dictionary object available in MS VC 2008 ?

Posted on 2010-11-27
11
427 Views
Last Modified: 2012-05-10
Hi experts!

I’m experience programmer in VB6 and C#, but totally new to MS VC 2008. I should use in C 2008 Win32 unmanaged code in OCX project object like Dictionary in C# , e.g. I need to make a collection of Long numbers (but to be string is also possible) and to be able to literate through collection, also to add and remove mebers of this collection at any time. What object I should use ?

I want to use only standard run-time libraries for C 2008.
0
Comment
Question by:dvplayltd
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 8

Accepted Solution

by:
Subrat (C++ windows/Linux) earned 500 total points
ID: 34222723
There is no such thing in standrd C. In C++ you can use STL.(std::map, std::multimap.. etc)
Refr:
http://www.cplusplus.com/reference/stl/map/
0
 
LVL 9

Expert Comment

by:masheik
ID: 34222727
There is standard c library in c#  
 
There is no standard runtime library (DLL) available like you said in c# or vb6
May be some other open source library can be found if you google                                   You can use structure to make collection and add whatever members you wanted to add.                             Example                structure
     {
    int longNum;
char string[255];
  }
If you wanted to add a structure dynamically then use linked lists  
0
 
LVL 9

Expert Comment

by:masheik
ID: 34222753
Oh I mistyped the first line
I mean there is no standard c library like dictionary handling library in c#
0
 
LVL 32

Expert Comment

by:phoffric
ID: 34223114
You can use the standard c library to implement your own dictionary. Hope one of these links helps you enough to morph the ideas here into your own needs.

http://w.e-e.com/qImdft
http://w.e-e.com/7NDu0m
http://w.e-e.com/lL3Zb8
http://w.e-e.com/GJZIOa
0
 
LVL 12

Expert Comment

by:trinitrotoluene
ID: 34228388
"I want to use only standard run-time libraries for C 2008."

I am a little confused with your statement above, however it appears that you want to use Visual Studio 2008 which comes with a C++ compiler. So assuming that you intend writing a C++ program I suggest you try using STL as one of the experts has suggested.

"I need to make a collection of Long numbers (but to be string is also possible)"

If there are no strict ordering requirements for your dictionary I would suggest you use the unordered_map which is the TR1 implementation of a hash_table.
http://en.wikipedia.org/wiki/Unordered_map_%28C%2B%2B%29

Unordered maps are used for their higher efficiency.

Also I would suggest that you move to Visual Studio 2010 rather than use Visual Studio 2008
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:dvplayltd
ID: 34228960
To Subrat2009

>>In C++ you can use STL.

Ok ... Look OK. But my question is connected with deploy my app on customer computer. Does I need to install additional file except MS VC run-time files ? I use MS VC++ 2008 . And I do not know, does this library free ?
0
 
LVL 12

Expert Comment

by:trinitrotoluene
ID: 34234755
yes it comes packaged with Visual Studio 2008.

http://msdn.microsoft.com/en-us/library/bb384632%28VS.90%29.aspx

And fyi Visual Studio 2008 is the name of the complete product suite, the VC++ compiler is one of the tools present in this suite. When you perform the installation of Visual Studio 2008 you will need to select which tools you need. Select the C++ compiler and it should take care of installing the required STL libraries and header files.

But like I said in my previous post, Microsoft has improved its implementation of the STL in Visual Studio 2010 which is what they recommend. So you could still use Visual Studio 2008 but if you have a chance to move to Visual Studio 2010 then I would suggest you do this. There will be no difference in the syntax of the code that you have to write for Visual Studio 2010 if thats what you are worried about.
0
 
LVL 12

Expert Comment

by:trinitrotoluene
ID: 34234767
here's another useful link in case you would like to do some additional reading

http://msdn.microsoft.com/en-us/library/60k1461a.aspx
0
 

Author Comment

by:dvplayltd
ID: 34236942
To trinitrotoluene

I know that STL is installed with VS 2008 and 2010, but I'll not install VS 2008 on customer computer when I deploy my app, right?
Question is simple - I made a OCX file and want to tell to user - to use it need to install ONLY runtime files for C++ 2008, not to install and additional librabry which make do conflict with already installed version and so on ...

I have more than 5 project in Vs 2008 in C#, MS VC and DO NOT WANT TO BORROW with possible problems with VS 2010. More - first SP1 for 2010 is not ready, I have learn my lesson in past with first version ... :-)

0
 

Author Closing Comment

by:dvplayltd
ID: 34251389
10x
0
 
LVL 12

Expert Comment

by:trinitrotoluene
ID: 34253354
Its obvious that you have to package the re-distributable with your application when you make a drop to your customer just in case he has a different runtime environment.

As for the STL packaging, this goes beyond what is known to the general public. Version 10 of the C++ compiler implements TR1 recommendations to a better degree than previous versions of the compiler if you understand what I mean, so the implementation of STL is far superior to what you will see with VS 2008

That was the reason I suggested that you use VS 2010 if you plan on using an unordered map.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now