You do realize that a 64 bit unsigned integer like a System::UInt64 does
_not_ fir in to a 32 bit unsigned integer such as a long?
If you are sure it won't overflow, just cast:
unsigned long unmanagedInt = static_cast<unsigned long>(managedInt);
If you want to use the same 64 bit type, just use:
unsigned long long unmangedInt = managedInt;
In physical reality there is no different between the System:: integer types
and the normal integer types in C++. Only when you take the address of them,
the type of pointer you get is different (in the 7.0 and 7.1 versions of
Visual C++, in the Whidbey version they will be identical in all respects).
Ronald Laeremans
Visual C++ team
"Mike Miller" <mm*****@bluecypress.net> wrote in message
news:f2**************************@posting.google.c om...
What is the best way to convert a managed unsigned int64 to an
unsigned long? Basically I need to do the following:
System::UInt64 managedInt = 10;
unsigned long unmanagedInt;
unmanagedInt = managedInt;
Also it would be nice to know how to do this:
System::UInt64 managedInt;
unsigned long unmanagedInt = 10;
managedInt = unmanagedInt;
Thanks for your help.
Mike