Am 16.11.2002 22:25:37, schrieb "Garst R. Reese" <[email protected]>:

>Sorry for this general C question.
>I need to transmitt 2 & 4 byte integers as a sequence of 2 or 4 bytes
>out the serial port. Is there a simple way to do this? Basically I want
>to treat the integers as an array of bytes.

assume: void serial_send( char * data, unsigned short len)

then you can use a typecast and the address operator:
serial_send( (char *)(&myint_or_short), 2);
serial_send( (char *)(&mylong), 4);

chris



Reply via email to