Passing CLR array to native function
I am working with the SerialPort class in .NET 2.0. I want to use the SerialPort's write() method as defined below with the following overloaded arguments.
public:
void Write (
array<unsigned char>^ buffer,
int offset,
int count
)
The program on the other end of the serialPort is using C code. The serialPort on the other end uses a serial port read function which takes in a unsigned char array.
ie. void read(unsigned int i)
Does anyone have any ideas how i can pass my data through? (ie from a CLR array to a function that takes native arrays). I am stuck as there are no overloaded write methods in SerialPort class which allow me to pass a native array. I can only think of one solution at the moment, and that is deriving my own class inherited from SerialPort and overload the write method to take in a native array, but i have no idea to write a method which will write data to a serial port.:(
PS. most of my work is already completed in .NET so there is no chance of starting over in unmanaged C++, and the other end cannot be changed to .NET as it is legacy system.

