K
Kevin Frey
Hello,
I want to do the equivalent of this in Managed C++:
void MyFunc( int n )
{
Byte[ ] mybuffer = new Byte[ n ];
socket.Receive( mybuffer ... );
}
The key point here is that I want to allocate an array of Bytes according to
a variable, not a constant-sized array.
The compiler complains that n is not constant. For our TCP communications
(porting from unmanaged C++) all of our packets are length prefixed, so we
read the length, then allocate the right amount of space for the buffer.
Can someone tell me how to achieve this?
Thanks
Kevin.
I want to do the equivalent of this in Managed C++:
void MyFunc( int n )
{
Byte[ ] mybuffer = new Byte[ n ];
socket.Receive( mybuffer ... );
}
The key point here is that I want to allocate an array of Bytes according to
a variable, not a constant-sized array.
The compiler complains that n is not constant. For our TCP communications
(porting from unmanaged C++) all of our packets are length prefixed, so we
read the length, then allocate the right amount of space for the buffer.
Can someone tell me how to achieve this?
Thanks
Kevin.