Beispiel #1
0
        static void Main(string[] args)
        {
            string filename = "zlibtest.gz";
            string s        = "Only a test, test, test, test, test, test, test, test!\n";

            // open file for writing with maximum compression
            PhpResource zp = Zlib.gzopen(new PhpBytes(filename), new PhpBytes("w9"));

            // write string to file
            Zlib.gzwrite(zp, new PhpBytes(s));

            // close file
            Zlib.gzclose(zp);

            // open file for reading
            zp = Zlib.gzopen(new PhpBytes(filename), new PhpBytes("r"));

            // output contents of the file and close it
            Console.WriteLine(Zlib.gzread(zp, 128));
            Zlib.gzclose(zp);

            Console.ReadLine();
        }