Here's the information: VS2005, using c++. I am trying to print out an enum value (as a string), and it works the first time, but not during any subsequent times. I'm wondering if there is just some obscure thing I don't know. Below is my code, Here is an explanation:
We have a custom TCP channel based object that can send and receive commands. That is what 'channel' is. Note that myEnum is just an enumeration with a bunch of commands in it. Please note that receiving the first command works fine and prints out fine too. However, cmd2 will not print out. What is even more bizarre is that the little floaty box thing when stepping through the program in Visual Studio DOES confirm that cmd2 is correct!!! It was received! But there is nothing on the console when printing.
std::cout << "We should have received ERRCORR_BEGIN. Command received == " << cmd << std::endl;
std::cout << "We should have received GET_BITS. Command received == " << cmd2 << std::endl;
You may note that the ReceiveCommand function takes a reference. In reality, it takes a pointer to a myEnum. So, I have tried all sorts of things with regards to using pointers, and printing out the addresses of the commands using both the & and the * operators, all to no avail. No matter what I do, the first one prints and the second one doesn't.
Thanks for any help.
P.S. I assign this a difficult rating, only because it's so simple and yet not working....what more could I be missing?