TCommsBuffer = packed record UnitID: Byte; FunctionCode: TModBusFunction; MBPData: TModBusDataBuffer; Spare: Byte; end; { TCommsBuffer }
SendBuffer: TCommsBuffer; -------------------------- I want to send the data in SendBuffer to serial port I define a array type: rcvData:TDataByte;(TDataByte = array of byte) setlength(rcvData, sizeof(SendBuffer ) ); count := datatosend; CopyMemory( @rcvData, @ SendBuffer , count); SeriComm.SendBuffer(@rcvData,count); when run to "CopyMemory( @rcvData, @ SendBuffer , count);" the program crash, what's wrong with me? Thanks. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal