[LUGOS] Problem z <LF> in <CR>

David Ipavec david.ipavec at amis.net
Thu Sep 6 22:49:33 CEST 2001


On Thu, Sep 06, 2001 at 08:23:45PM +0200, Damir Dezeljin wrote:

> Pozdravljeni,
> 
> imam en anemometer, za katerega pise v manualu da naj bi vsako vrstico
> podatkov zakljucil z <CR><LF>, torej naj bi zgledalo nekaj takega:
> <podatek><CR><LF> ... no ce v dosu recimo z procomm programom naredim log
> datoteko je to tudi res, ce pa v Linuxu s svojim programckom berem iz com
> porta in pisem v datoteko, dobim <podatek><LF><LF> ... ne mi rect da sem
> falu pri pisanju programa, ker sem restartal kisto in naredil:
> cat /dev/ttyS0 >> log.dat in spet sem dobil isto sranje, torej
> <podatek><LF><LF> .
> 
> Kaj ve kdo zakaj se to dogaja? Kaj ve kdo kaj res dobivam na COM portu?
> Kaj ve kdo kako se temu izognit ... skratka vprasanj je tu cel kup?

Nimam izkusenj z programiranjem serijskega porta, ampak mogoce si res falu.

Mogoce je tole.

iz "info libc"
----------------------------------------------------------------
 - Macro: tcflag_t IGNCR
 If this bit is set, carriage return characters ('\r'') are
 discarded on input.  Discarding carriage return may be useful on
 terminals that send both carriage return and linefeed when you
 type the <RET> key.
 
 - Macro: tcflag_t ICRNL
 If this bit is set and IGNCR' is not set, carriage return
 characters ('\r'') received as input are
 passed to the
 application as newline characters ('\n'').
 
 - Macro: tcflag_t INLCR
 If this bit is set, newline characters ('\n'') received as input
 are passed to the application as carriage return characters
 ('\r'').
________________________________________________________________


Preberi tudi  Serial-Programming HOWTO




More information about the lugos-list mailing list