NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Writing data to serial device failed

On Jan 26, 2011, at 5:44 10PM, David Young wrote:

> On Wed, Jan 26, 2011 at 11:06:28PM +0100, Volker Wolfram wrote:
>> Hi all,
>> Google helps me not further. I use this litte program to switch on a LED
>> on a USB-I2C adapter. This sample code works not.              
> *snip snip*
>>              err = write(fd,"\5a\x10\x0e\x00",4);
> Do you mean to write {0x5a, 0x10, 0x0e, 0x00} ? Double-check that string
> constant.

That isn't what the string is, of course -- that first one is \5a rather than
\x5a, so it's writing 0x05, 'a', 0x10, 0x0e, 0x00, which is 5 bytes long.

                --Steve Bellovin,

Home | Main Index | Thread Index | Old Index