From owner-freebsd-questions@FreeBSD.ORG Fri Sep 9 13:10:47 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 78A3D16A41F for ; Fri, 9 Sep 2005 13:10:47 +0000 (GMT) (envelope-from helge.preuss@gmx.net) Received: from mail.gmx.net (pop.gmx.net [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 737B643D46 for ; Fri, 9 Sep 2005 13:10:46 +0000 (GMT) (envelope-from helge.preuss@gmx.net) Received: (qmail invoked by alias); 09 Sep 2005 13:10:45 -0000 Received: from unknown (EHLO [192.168.128.143]) [62.8.202.38] by mail.gmx.net (mp032) with SMTP; 09 Sep 2005 15:10:45 +0200 X-Authenticated: #6367088 Message-ID: <432189D5.2070307@gmx.net> Date: Fri, 09 Sep 2005 15:10:45 +0200 From: Helge Preuss User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: vittorio References: <200509091353.49269.vdemart1@tin.it> In-Reply-To: <200509091353.49269.vdemart1@tin.it> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Cc: freebsd-questions@freebsd.org Subject: Re: Fwd: Re: C program to write to the com port - RESOLVED X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2005 13:10:47 -0000 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 HTH, haven't tried it Helge