home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / pascal / 8500 < prev    next >
Encoding:
Text File  |  1993-01-24  |  1.4 KB  |  37 lines

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