Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Sep 2005 15:10:45 +0200
From:      Helge Preuss <helge.preuss@gmx.net>
To:        vittorio <vdemart1@tin.it>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Fwd: Re: C program to write to the com port - RESOLVED
Message-ID:  <432189D5.2070307@gmx.net>
In-Reply-To: <200509091353.49269.vdemart1@tin.it>
References:  <200509091353.49269.vdemart1@tin.it>

next in thread | previous in thread | raw e-mail | index | archive | help
vittorio wrote:

>[...]
>SerialPort.C: In function `int main(int, char*)':
>SerialPort.C:62: error: invalid conversion from `unsigned char*' to `char*'
>SerialPort.C:62: error:   initializing argument 1 of `int snprintf(char*, 
>size_t, const char*, ...)'
>SerialPort.C:66: error: `err' undeclared (first use this function)
>SerialPort.C:66: error: (Each undeclared identifier is reported only once for 
>each function it appears in.)
>SerialPort.C:69:3: warning: no newline at end of file
>
>Could you please help to straighten things up?
>  
>
A relevant line from man snprintf:
 > int snprintf(char *str, size_t size, const char *format, ...);
So you might want to change line 27 to
    char buf[4];
and perhaps line 62 too:

  snprintf(buf,4,"%c%c%c%c",(char)0xff,0x00,0x01,0);
another relevant line from man err:
>  #include <err.h>

HTH, haven't tried it

Helge





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?432189D5.2070307>