Path: utzoo!utgpu!watserv1!watmath!att!dptg!ulysses!andante!princeton!udel!wuarchive!zaphod.mps.ohio-state.edu!usc!snorkelwacker!bloom-beacon!eru!luth!sunic!mcsun!hp4nl!sci.kun.nl!atcmpe!ronald From: ronald@atcmp.nl (Ronald Pikkert) Newsgroups: comp.unix.questions Subject: Re: Lex and redefining the i/o macros Message-ID: <636@atcmpe.atcmp.nl> Date: 16 Jul 90 09:19:16 GMT References: <859@airgun.wg.waii.com> Organization: AT Computing, Nijmegen, The Netherlands Lines: 29 From article <859@airgun.wg.waii.com>, by lampshir@airgun.wg.waii.com (gregory b. lampshir): <> char input() <> { <> int pos; <> char *ch; <> <> pos=read(filePointerIn,ch,1); <> if(pos==0) return(0); /* needed by lex to signal eof */ <> else return(*ch); <> } <> <> Can any of you lex wizards help me with this one? What am I doing wrong? How about initialising the pointer ch? Or just write something like: char ch; if (read(filePointerIn,&ch,1)!=1) return(0); return(ch); By the way, how about not using a system call for every single character that is to be read? - Ronald Pikkert E-mail: ronald@atcmp.nl @ AT Computing b.v. Tel: 080 - 566880 Toernooiveld 6525 ED Nijmegen