[ILUG] Serial Port
Kenn Humborg
kenn at bluetree.ie
Tue Apr 11 15:41:17 IST 2000
> char a_string[15] = "today is april ";
> int date = 11;
> sprintf(outgoing_msg,"%s %d",a_string,date);
>
> bytes_written = write(serial_port_fd,outgoing_msg,255);
>
> outgoing_msg isn't 255 long but is padded with zeros;
Don't send a bunch of zeros unnecessarily. Write the
correct number of bytes:
char a_string[15] = "today is april ";
int date = 11;
int bytes_to_write;
bytes_to_write = sprintf(outgoing_msg,"%s %d",a_string,date);
bytes_written = write(serial_port_fd,outgoing_msg,bytes_to_write);
Later,
Kenn
More information about the ILUG
mailing list