Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!decwrl!glacier!Navajo!rokicki From: rokicki@Navajo.ARPA (Tomas Rokicki) Newsgroups: net.micro.amiga Subject: EOF, SEEK, and fast output to PAR: and SER: Message-ID: <503@Navajo.ARPA> Date: Sat, 12-Apr-86 17:48:36 EST Article-I.D.: Navajo.503 Posted: Sat Apr 12 17:48:36 1986 Date-Received: Mon, 14-Apr-86 04:03:28 EST Organization: Stanford University Lines: 32 Keywords: EOF, SEEK, Buffered Output First, a complaint---why the heck does ctl-\ (EOF) return a new line and then EOF? (Try typing it to the CLI prompt, you'll see what I mean.) That extra new line is messing things up! Can this be fixed? Please? Secondly, Seek seems to take an inordinate amount of time. When reading a file, it is much faster to have a for loop read one hundred characters, than to execute a Seek forward one hundred bytes. Another kludge required to get around this. Finally, for those of you driving SER: or PAR: from C, there is a way to get much faster output than the default single-character buffered output. Stick in the following magic lines: if ((fp=fopen(iname,"r"))==NULL) err("! hey, buddy, give me a break") ; /* this your code */ if (fp->_buff==NULL) if ((fp->_buff=malloc(BUFSIZ))!=NULL) { fp->_buflen = BUFSIZ ; fp->_flags |= _ALLBUF ; } Don't forget to declare malloc (char *malloc()) and include stdio.h. This works with Manx; haven't tested it with Lattice, and makes things incredibly faster. For an explanation of how it works, I'd have to explain the I/O library, and since that belongs to Manx, I'm not sure I can legally do that. It won't screw up i/o to disk, either, so I use it in any open that can go to the printer, serial port, or disk. I believe it will mess up console I/O (buffering things that go to the screen in huge chunks is not generally wise), so be careful. I've been playing with the blitter lately; that thing is incredibly fast.