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


Reply via email to