(define vect (make-u8vector 3)) (call-with-input-string "string" (lambda (pt) (read-subu8vector vect 0 2
pt)))
*** ERROR IN call-with-input-string -- Input port character buffer is not empty (read-subu8vector '#u8(0 0 0) 0 1 '#<input-port #2 (string)>)
read-subu8vector calls macro-lock-and-check-input-port-character-buffer-empty I guess it's a bug since I don't see what would be the use. Or enlighten me...
Afficher les réponses par date
On 21-Feb-08, at 4:51 PM, Jeremie Lasalle Ratelle wrote:
(define vect (make-u8vector 3)) (call-with-input-string "string" (lambda (pt) (read-subu8vector
vect 0 2 pt)))
*** ERROR IN call-with-input-string -- Input port character buffer is not empty (read-subu8vector '#u8(0 0 0) 0 1 '#<input-port #2 (string)>)
read-subu8vector calls macro-lock-and-check-input-port-character- buffer-empty I guess it's a bug since I don't see what would be the use. Or enlighten me...
The error message is wrong (now fixed on the repository). You should have gotten:
(define vect (make-u8vector 3)) (call-with-input-string "string" (lambda (pt) (read-subu8vector
vect 0 2 pt))) *** ERROR IN call-with-input-string -- (Argument 4) Byte INPUT PORT expected (read-subu8vector '#u8(0 0 0) 0 2 '#<input-port #2 (string)>)
The correct thing to do is to read from a byte port, for example a u8vector port:
(call-with-input-u8vector '#u8(48 49 50 51) (lambda (pt) (read-
subu8vector vect 0 2 pt))) 2
vect
#u8(48 49 0)
Marc
On 21-Feb-08, at 4:51 PM, Jeremie Lasalle Ratelle wrote:
(define vect (make-u8vector 3)) (call-with-input-string "string" (lambda (pt) (read-subu8vector
vect 0 2 pt)))
*** ERROR IN call-with-input-string -- Input port character buffer is not empty (read-subu8vector '#u8(0 0 0) 0 1 '#<input-port #2 (string)>)
read-subu8vector calls macro-lock-and-check-input-port-character- buffer-empty I guess it's a bug since I don't see what would be the use. Or enlighten me...
Sorry, I should have added that to get what you want you can:
(define vect (make-u8vector 3)) (define pt (open-u8vector)) (display "string" pt) (force-output pt) (read-subu8vector vect 0 2 pt)
2
vect
#u8(115 116 0)
Marc