[plt-scheme] seek/tell for ports...
Is it possible to do that with a non-file port?
As in,
(define-values (i o) (make-pipe))
(display "abcdefghijklmnopqrstuvwxyz" o)
(file-position i)
(file-position i 10)
?
If it does, why is it called 'file-position'?
If it doesn't, why not?
-----Original Message-----
From: Eli Barzilay [mailto:eli at barzilay.org]
Sent: Wednesday, December 17, 2003 5:48 AM
To: riandouglas at iprimus.com.au
Cc: PLT-Scheme
Subject: Re: [plt-scheme] seek/tell for ports...
For list-related administrative tasks:
http://list.cs.brown.edu/mailman/listinfo/plt-scheme
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!