[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] some progress on zlib

From: Peter Keller
Subject: [Chicken-users] some progress on zlib
Date: Tue, 17 Sep 2002 23:19:33 -0500
User-agent: Mutt/1.2i


After figuring out I could pass a byte-vector into a foreign-lambda
declaration where something expects a void* that is treated as a char*,
my zlib FFI has come into reality.

Here's an example:
(declare (uses zlib))
(require 'srfi-4)
(require 'lolevel)

;; test.gz contains "Hello World" as compressed by gzip
(let (  (fin (gzopen "test.gz" "r"))
        (data (make-byte-vector 1024 0)))

    (gzread fin data 12)
    (print "Read: " (byte-vector->string data))
    (gzclose fin))
;; Wow, actually printed Hello World!

I figure in a week or so(or in a single night, depending on time and
motivation), I'll have enough of the API to do very, very basic file i/o
where you can read or write compressed files. When I get to that point,
I'll package it up nice and release it since it can be useful right away
to someone.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]