• C

Does Dictionary object available in MS VC 2008 ?

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.
Who is Participating?
Subrat (C++ windows/Linux)Connect With a Mentor Software EngineerCommented:
There is no such thing in standrd C. In C++ you can use STL.(std::map, std::multimap.. etc)
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  
Oh I mistyped the first line
I mean there is no standard c library like dictionary handling library in c#
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

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.

trinitrotolueneDirector - Software EngineeringCommented:
"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
dvplayltdAuthor Commented:
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 ?
trinitrotolueneDirector - Software EngineeringCommented:
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.
trinitrotolueneDirector - Software EngineeringCommented:
here's another useful link in case you would like to do some additional reading

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

dvplayltdAuthor Commented:
trinitrotolueneDirector - Software EngineeringCommented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.