[Chicken-users] read-line (and probably other input routines) - unexpect
From:
$)
Subject:
[Chicken-users] read-line (and probably other input routines) - unexpected behaviour when reading binary files on Windows
Date:
Tue, 17 Oct 2006 13:42:25 +0400
---------- Forwarded message ---------- From: $) <address@hidden> Date: 17.10.2006 13:30 Subject: read-line (and probably other input routines) - unexpected behaviour when reading binary files on Windows
To: address@hidden
Hi! The Chicken manual says that read-line consumes all input from the current input port untill #!eof when called without parameters.
The weird thing is that Scheme IO treats #\x1a (character with code 27) as #!eof when reading from file. The following code snippet prints #!eof:
(define crash-pattern "\x1a (esc) breaks read-line \x1a it is weird") (with-output-to-file "test.scm.123" (lambda() (display crash-pattern))) (print(with-input-from-file "test.scm.123
" read-line))
The file "test.scm.123" is written successfully. So I guess that something goes wrong while reading the file?
With-input-from-string or even reading from custom port behaves as expected:
(print (with-input-from-string crash-pattern read-line)) ; doen't trim crash-pattern
(print (with-input-from-port (my-make-string-port crash-pattern) read-line)) ; doesn't trim crash-pattern as well
I wonder if this behaviour is by design? Are there any issues related to reading and writing binary data with ports in Chicken Scheme?