Save long int array to binary file

bwells

Well-known member
Joined
Feb 25, 2003
Messages
84
I have an array of long integers and I want to save them to a binary file. I can do this in managed or unmanage c++. What is the easiest way to do this?

thanks
Bryan
 
If you can do it in either, Id use managed C++.

Or, are you asking *how* to do it in either managed or unmanaged?

-Ner
 
Yes, I was asking how to do it in Managed code.

I have a way that I got to work, but I am not sure its the prefered way. I am using a FileStream and the BinaryWriter.Write method. But the binary writer write method does not take a unsigned long so I cast it to be _int32. Do you think this works? What would you recommend? I have an array of unsigned longs to write, but when I did an array write, it was writing bytes insead of longs. Is there a way to write an array of unsigned longs from Managed C++, or should I iterate over the array and write each element?

thanks
Bryan
 
Back
Top