Hi all,
c++
I have a buffer
array<unsigned char>^ buffer = gcnew array<unsigned char>(11);
I keep my data here to send to the serial port
I would like to call a function with a pointer to buffer
I tried:
// define class CRC
CRC df1;
df1.check_crc(&buffer, 4);
but obviously it can't convert buffer to a cli unsigned char.
the check_crc funtion in class CRC
unsigned char check_crc(unsigned char *buffer, unsigned char length)
{
unsigned char temp_crc =0;
for(unsigned char temp =6; temp < length+6; temp++)
{
temp_crc = check(temp_crc, *buffer);
*buffer ++;
}
return temp_crc;
}
anyone a idea?
buffer is already a pointer. So you should specify it as argument.
yes but I can not convert a
array<unsigned char>^ buffer = gcnew array<unsigned char>(11);
into a function call like
unsigned char check_crc(unsigned char *buffer, unsigned char length)
so what would be the best solution?
Thanks codeMonkey,
are only array's managed variables or is it preferable to create normal int, char etc also as managed variables?
Last edited on