home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!cs.utexas.edu!torn!news.ccs.queensu.ca!slip207.telnet1.QueensU.CA!dmurdoch
- From: dmurdoch@mast.queensu.ca (Duncan Murdoch)
- Subject: Re: Look-a-head (input^) in TPASCAL...???
- Message-ID: <dmurdoch.342.727927944@mast.queensu.ca>
- Lines: 25
- Sender: news@knot.ccs.queensu.ca (Netnews control)
- Organization: Queen's University
- References: <35202@adm.brl.mil>
- Date: Mon, 25 Jan 1993 02:12:25 GMT
-
- In article <35202@adm.brl.mil> ISAACSON@husc3.harvard.edu (RON ISAACSON) writes:
- >
- >That "file buffer variable", as it's called, is something I missed
- >sorely when I went over to Turbo Pascal. I wrote a little function
- >to replace it. This thing is by no means foolproof, and there are
- >probably several modifications that could be made, but in general
- >for just looking one byte ahead in a file this function works fine.
- >
- >function filebuff(var infile : text) : char;
- > var
- > fp : longint;
- > ch : char;
- > begin
- > {$I-} { turn off i/o checking, end of file, etc. }
- > fp := filepos(infile); { get the current position into the open file }
- > seek(infile, fp + 1); { move the pointer ahead by one }
-
- ??? Neither Filepos nor Seek work for text files in BP 7. Which version are
- you using?
-
- If you want to peek ahead at the next character, you have to implement
- FilePos and Seek for text files (which may be what you did), or work at the
- text file device driver level.
-
- Duncan Murdoch
-