🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #10100

Re: Leyendo datos puerto serie

#10100
From: NotFound
Date: Sun, 24 Mar 2002 20:29
18 lines
1416 bytes
>   do
>     {
>       leidos = read (fd, buffer, sizeof (buffer));
>       buffer[leidos] = 0;

Si has leido sizeof (buffer) bytes, el 0 lo escribes fuera del buffer.

>       if (isprint (buffer[0]))
>          printf ("%s\t%X\n", buffer,atoi(buffer));
>       else
>          printf ("*\t%X\n",atoi(buffer));

Si buffer [0] no es imprimible entonces no es un dígito, entonces atoi
da 0. Si es imprimible pero no es un dígito también.

Pon simplemente (int) buffer [0]

Salu2
Technical Details
Message-ID: <3C9E3738.DD506832@hobbiton.org>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!news.tele.dk!small.news.tele.dk!195.158.233.21!news.ebone.net!news1.ebone.net!cesio.mundo-r.com!not-for-mail
References: <slrna9s9rj.1bh.jpozdom@sol.linux.bogus>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,5223a508e1e82079
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-03-24 13:14:40 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!news.tele.dk!small.news.tele.dk!195.158.233.21!news.ebone.net!news1.ebone.net!cesio.mundo-r.com!not-for-mail
From: NotFound <blassic@hobbiton.org>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Leyendo datos puerto serie
Date: Sun, 24 Mar 2002 21:29:44 +0100
Organization: Another Netscape Collabra Server User
Lines: 18
Message-ID: <3C9E3738.DD506832@hobbiton.org>
References: <slrna9s9rj.1bh.jpozdom@sol.linux.bogus>
NNTP-Posting-Host: cm64229.red.mundo-r.com
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Mailer: Mozilla 4.72 [en] (X11; I; Linux 2.2.14 i586)
X-Accept-Language: en