Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!canon!imlah From: imlah@canon.co.uk (Bill Imlah) Newsgroups: comp.lang.prolog Subject: Re: why do i need an extra carridge return? Message-ID: <1991Apr29.102537.12322@canon.co.uk> Date: 29 Apr 91 10:25:37 GMT References: <9104262300.AA24421@thunder.LakeheadU.Ca> Organization: Kenny's Fish Bar (Turbot with a Smile) Lines: 29 delingma@THUNDER.LAKEHEADU.CA writes: >If anyone ...has some sample >code to allow me to read in characters into a list that stops >after getting a carridge return, I would really appreciate it. Here is some working code. Prolog gurus: I'm a mere user so if you're going to flame it, flame it in a nice way, as Dame Edna would say... read_line(L):- get_chars([],L). get_chars(IN,OUT):- get0(C), get_rest(C,IN,OUT). get_rest(10,L,L):- !. get_rest(C,IN,[C|OUT]):- get_chars(IN,OUT). -------------------------------------------------------- Bill Imlah imlah@canon.co.uk Canon Research Centre Europe, 17/20 Frederick Sanger Rd. The Surrey Research Park, Guildford, Surrey, GU2 5YD, UK. -- "If it ain't broke, don't fix it"