[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with truncated string ports - more info
From: |
Brent Pinkney |
Subject: |
Re: Problem with truncated string ports - more info |
Date: |
Fri, 21 Jun 2013 16:15:03 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 |
Hi,
I have some further diagnostics on my problem.
As you know the string resulting from a call to write should be at least
two (2) characters longer than the input string since the input string
is prepended and appended with a #\x quotation character.
This is indeed the case for short strings:
(define s (make-string 64 #\x))
(string-length (with-output-to-string (lambda () (write s))))
; answers 66 - OK
This true all the way up to an input string of length 4094 (i.e. 4096 -2 ).
However, if I make the input string 4095 bytes long, then I do not get
the expected 4097 long output string.
Instead, I get a resulting string truncted to 4096 bytes.
(define s (make-string 4095 #\x))
(string-length (with-output-to-string (lambda () (write s))))
; answer 4096 - WRONG.
Thanks,
Brent