Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!ucsd!sdcc6!ir230 From: ir230@sdcc6.ucsd.edu (john wavrik) Newsgroups: comp.lang.forth Subject: Re: Reading seq files with F83 (Help) Message-ID: <6168@sdcc6.ucsd.edu> Date: 17 Jan 90 22:59:53 GMT References: <9001161917.AA02453@jade.berkeley.edu> Organization: University of California, San Diego Lines: 34 In response to request concerning reading of reading textfiles in F83: Create a file BLANKS.BLK which contains only 1024 blanks and use this to pad the end of your file: COPY /B +BLANKS.BLK Padding the file will insure that everything gets read. Using the /B switch will preserve the end of file marker in your file. Your file can now be treated as a file of characters. : FilePos ( n -- addr ) 1024 /MOD BLOCK + ; will give the "address" of the n-th character in the file. What happens next depends on the type of file and what you plan to do with it. It is easy to define: GetChar which reads characters sequentially (skipping CR/LF terminators and setting variables EOLN, and EOF in the customary way) Readln which reads a line at a time to a buffer You can also read structured files of any sort, write files, and any combination (the variable FILE holds the address of the FCB of the file which to which BLOCK currently refers -- see also IN-FILE, IN-BLOCK). Writing routines must include UPDATE (and should use FLUSH at the end). John J Wavrik jjwavrik@ucsd.edu Dept of Math C-012 Univ of Calif - San Diego La Jolla, CA 92093