Does Dictionary object available in MS VC 2008 ?

Posted on 2010-11-27
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.
Question by:dvplayltd
  • 4
  • 3
  • 2
  • +2

Accepted Solution

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)

Expert Comment

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  

Expert Comment

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

Expert Comment

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.
LVL 12

Expert Comment

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.

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
Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  


Author Comment

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 ?
LVL 12

Expert Comment

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

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.
LVL 12

Expert Comment

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

Author Comment

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 ... :-)


Author Closing Comment

ID: 34251389
LVL 12

Expert Comment

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.

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
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 while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

910 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

23 Experts available now in Live!

Get 1:1 Help Now