[plt-scheme] seek/tell for ports...

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Dec 16 22:47:30 EST 2003

On Dec 17, riandouglas at iprimus.com.au wrote:
> Is there a method to seek to a position in a file, and get the
> current position in a file, as in the C fseek/ftell functions.

  Welcome to MzScheme version 205, Copyright (c) 1995-2003 PLT
  > (with-output-to-file "x" (lambda () (display "abcdefghijklmnop")))
  > (define x (open-input-file "x"))
  > (file-position x)
  0
  > (file-position x 10)
  > (list (read-char x) (read-char x))
  (#\k #\l)
  > (file-position x)
  12

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.