|
Nish, C++/CLI is just plain too confusing for people. Most non MFC C++ questions seem to end up in here nowadays.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote: Nish, C++/CLI is just plain too confusing for people. Most non MFC C++ questions seem to end up in here nowadays.
Uhm, if a guy cannot differentiate between MFC and C++/CLI, it's worth asking the question as to whether he's ready for either (MFC or C++/CLI).
-- modified at 12:51 Tuesday 15th November, 2005
|
|
|
|
|
The point is that most people don't know what C++/CLI *means*, they assume it's a general C++ forum, as opposed to the Visual C++ forum, which they assume is for MFC and other 'visual' stuff.
That's my observation, I learned ages ago to look in here every day, even though I know very little about CLI.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Why on earth would a query about the C++ standard template library aka STL be in the microsoft foundation class or visual C++ forum?
I doubt that Alexander Stepanov and Meng Lee at Hewlett-Packard in Palo Alto, California, Dave Musser at General Electric's Research Center in Schenectady, New York, Andrew Koenig, and of course "Mr C++" himself, Bjarne Stroustrup at AT&T Bell Laboratories would put such a query in a MS forum?
And rather than give out a terse (bordering on rude) reply like Nish's why not suggest an answer and if it genuinely belongs in another forum educate the user so?
Dissapointed I am
|
|
|
|
|
i do agree perfectly... so here comes my question :
why do you continue the thread instead of ignoring it ?
if you don't agree with some things, use the voting to express your feeling about that... (which is what i am going to do now )
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Jeremy Thornton wrote: Why on earth would a query about the C++ standard template library aka STL be in the microsoft foundation class or visual C++ forum?
Because the STL forum also caters to ATL and WTL, yet is a ghost town ? A lot of people do not know what CLI is, and assume that this forum is for 'standard C++' questions.
Jeremy Thornton wrote: I doubt that Alexander Stepanov and Meng Lee at Hewlett-Packard in Palo Alto, California, Dave Musser at General Electric's Research Center in Schenectady, New York, Andrew Koenig, and of course "Mr C++" himself, Bjarne Stroustrup at AT&T Bell Laboratories would put such a query in a MS forum?
Who gives a toss what they would do ? People who are learning C++ are now required to understand it well enough to know which bits are STL before they are allowed to ask for help ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm sorry my views drove you to angry expletive I have tried to move what I thought was an important topic to the suggestions forum.
Christian Graus wrote: People who are learning C++ are now required to understand it well enough to know which bits are STL before they are allowed to ask for help ?
No that is the opposite of what I had intended to convey.
|
|
|
|
|
You have to test!
A STL map can only store one value per key.
If you use a second instance of the key it will supercede the existing one. If this is not intended then you should use a multimap.
You can see if a key is pre-existing by using the maps own find method and comaparing the result with the map's end iterator. If it reaches the end it isnt in the map
map<key,data>::iterator it
it = some_map_or_other.find( the_key );
if ( it != some_map_or_other.end() ) {
}
further, you can test if an item already exists in a map with the single arguement version of insert. This method returns a STL pair cpnsisting of an iterator & a bool. Now if the insertion was unsuccesful the bool will be false and the iterator will be at the duplicate key.
hope this helps?
-- modified at 8:46 Thursday 24th November, 2005
|
|
|
|
|
hi,
I'm trying to use a class that need to be shared in managed and unmanaged C++ code. Since the two style have different ways of handling strings, what should I do to manage string type of member variables? Thanks!
dummy808
-- modified at 23:18 Sunday 13th November, 2005
|
|
|
|
|
It's trivial to convert between CString and System::String, so there really shouldn't be any problem.
|
|
|
|
|
Thanks for the reply. But this is not just about conversion, it's about how to define string type members in the class. Managed code can only see managed part of the class member, which has to be of String * type, while unmanaged code can only see unmanaged part, which can only be of std::string or CString type. And if I create same member name for both managed and unmanaged part, the managed file would lose information when trying to use the object that's created in unmanaged code. hope I made myself clear enough. Thanks again for the help.
|
|
|
|
|
We recently upgraded some of our test machines to the .NET 2.0 framework, and discovered that this breaks some of the managed C++ DLLs we use in our install program. Unfortunately, when I try to debug these DLLs in VS.NET 2003, it crashes the IDE. (I'd love to know why so I can find the actual cause of the problem in the DLL, BTW, if anyone knows....) So I'm left with the alternative of trying to force the version of .NET that the DLL will load. I can't seem to find a way to do that either. Any hints?
|
|
|
|
|
If the DLLs were compiled using VC++ 2003, then they target .NET 1.1, so to run them on the target machine, it needs to have .NET 1.1 installed.
|
|
|
|
|
The DLLs were compiled using VC++ 2003, but apparently that doesn't mean they have to target .NET 1.1.
I wrote a little C program to load the DLL and call the function I want. (It exports all its functionality through C function calls so it can be called from an install program.) I have both .NET 1.1 and .NET 2.0 installed on my system. When I debug the DLL using the C program and VC++ 2003, the .NET 2.0 DLLs are the ones that get loaded, not .NET 1.1. Unfortunately, as soon as the CRT 8.0 DLL is loaded, the IDE crashes.
So far as I can tell, there's nothing that lets the DLL say what the minimum or maximum .NET version supported is....
|
|
|
|
|
I need help writing the code to delete from a binary search tree if any body code offer up some C++ code for this it would be greatly appreciated!
|
|
|
|
|
darylesha wrote: I need help writing the code to delete from a binary search tree if any body code offer up some C++ code for this it would be greatly appreciated!
You should ask this in the VC++ forum :-
VC++ forum[^]
|
|
|
|
|
Could some one please help out with this?
We generate random numbers using the random no generator code given below. We generate these random numbers for several applications (up to 200). This means that every application runs this function with different seeds.
long node :: RandomNo(long m)
{
long double k, temp ;
long z;
k = Congruential.Seed / 53668;
Congruential.Seed = 40014 *(Congruential.Seed - k *53668) - k*12211 ;
if (Congruential.Seed < 0)
Congruential.Seed = Congruential.Seed + 2147483563;
k = Congruential.Seed2 / 52774;
Congruential.Seed2 = 40692 *(Congruential.Seed2 - k *52774) - k*3791 ;
if (Congruential.Seed2 < 0)
Congruential.Seed2 = Congruential.Seed2 + 2147483399;
z = Congruential.Seed - Congruential.Seed2 ;
if(z < 1)
z = (long) (z +2147483562) ;
temp = (z * 4.656613) / (10000000000);
z = (long)(temp * 10000000);
z = long( z % long(m+1));
return (z);
}
The seeds are got as per the application number through the function shown below
void node :: SetLinearCongruential(int nno)
{
unsigned long g_lSeed[2]={12345678,23456789};
Congruential.Seed = (g_lSeed[0])*nno;
Congruential.Seed2 = (g_lSeed[1])*nno;
return;
}
The problem is that the random number stop for certain application after a certain point of time.
Example
Average no of application runs - 300,000
Application no runs
35553
46 57889
57 123435
87 67345
This example shows that applications 31,46,57 & 87 have much lower average applications runs as compared to the rest.
These values how ever change when the seed (g_lSeed[i]) value is changed.
We need to ensure that all applications have the same number of runs.
Can some one pls help out?
Thanks in advance
when goin' gets tough, tough gets goin'
amar
|
|
|
|
|
Hi,
I've a big problem. I should set the values of 6 channels from 5.1 sound card (VIA EPIA MII Mainboard
OnBoard Audio: VIA VT1616 6 channel AC’97 Codec; Treiber: vinyl97 6.14.0001.4120). I guess the best way is to do this by using the winmm.dll, mixer API. I tried i lot, but without success. I can set the volume for the master volume, but not for all 6 channels separately.
The other porblem is to set values for frequencies for a graphic equlizer (graphic equlizer like in WinAmp).
Does anybody has an idea how to solve this problem?
great thanks
werner
|
|
|
|
|
There might be a way through the winmm.dll to se the volume independently per channel but the other thing you're talking about (setting up the equlizer) is an application specific task. You can easily tell by changing the settings of the equlizer in winamp and listening on mediaplayer. You should quickly notice there is no cahnge in MediaPlayer when you change settings in winamp. The point being here that there is no windows platform API for operation on the equlizer. For Winamp there is an SDK that you can download from their website.
|
|
|
|
|
I have been given a Connect 4 game engine and have to come up with a "move" function for my AI that returns a column number. My AI will then be run against an opponent's AI to determine a winner or a tie. Can anyone help me with the C++ code for a decent AI?
|
|
|
|
|
|
I have a class called HotelRoom, and I create hotelRooms by doing this:
extern HotelRoom *hotelRooms[10];
in a header file.
This is my try to save this pointer to a file:
void saveFile()
{
char filename[100] = "HotelRegister.dat";
ofstream f(filename);
for (int i = 0; i < 10; i++)
{
f.write((char*) &hotelRooms[i], sizeof(hotelRooms[i]));
}
f.close();
}
void loadFile()
{
char filename[100] = "HotelRegister.dat";
ifstream f(filename);
for (int i = 0; i < 10; i++)
{
//hotelRooms[i] = new HotelRoom();
f.read((char*) &hotelRooms[i], sizeof(hotelRooms[i]));
}
f.close();
}
These 2 functions are aswell extern decleared in the header file.
I have already tested to take away the [i] and for loops but that gives same result, so my conclusion would be that the program crashes(runtime error) because of a memory problem caused by hotelRooms being a pointer and beacause it somewhy doesn't get initialized right?
//for(i = 0; i < 10; i++)
//hotelRooms[i] = new HotelRoom(ROOM_LUXURYCLASS, true, "Hmm kk");
//hotelRooms[i] = new HotelRoom();
//saveFile();
loadFile();
Some of it is commentated because I have tested and switched between those.
I hope someone know about pointers like this alittle better and can help me with this problem
Thanks in advance!
Best Regards,
Hmmkk
|
|
|
|
|
|
Well, as always its you and thanks for answering.
But... It doesn't really "point out" what I need to change in my code unless the thing you wanted to show is that f.read and f.write can be changed to Inserters instead...
Is it really the saving/loading part that is done wrong? Isn't it possible to do it in a similiar way that I showed?
Best Regards,
Hmmkk
|
|
|
|
|
Did I misread the question ? If you want to stream a custom type, you need to write inserters and extractors. Or at least, that is the correct way to do it. What you did looks like it *should* work, but I wouldn't know, I'd never consider doing it that way when iostreams has a nice way of doing it built in.
Christian Graus - Microsoft MVP - C++
|
|
|
|