apps/ccam/gzprintf.c

Go to the documentation of this file.
00001 /* example.c -- usage example of the zlib compression library
00002  * Copyright (C) 1995-2002 Jean-loup Gailly.
00003  * For conditions of distribution and use, see copyright notice in zlib.h 
00004  */
00005 
00006 /* @(#) $Id: gzprintf.c,v 1.1.1.1 2007/06/25 18:20:19 elphel Exp $ */
00007 
00008 #include <stdio.h>
00009 #include "zlib.h"
00010 
00011 #include <string.h>
00012 #include <stdlib.h>
00013 
00014 
00015 #define CHECK_ERR(err, msg) { \
00016     if (err != Z_OK) { \
00017         fprintf(stderr, "%s error: %d\n", msg, err); \
00018         exit(1); \
00019     } \
00020 }
00021 
00022 
00023 int  main               (int argc, char *argv[]);
00024 
00025 /* ===========================================================================
00026  * Test read/write of .gz files
00027  */
00028 
00029 int main(argc, argv)
00030     int argc;
00031     char *argv[];
00032 {
00033         int printPos,printPosInc,i;
00034     gzFile file;
00035 
00036 
00037    printf( "The file handle for stdout is %d\n", _fileno( stdout ) );
00038 
00039 
00040 //    file = gzopen("test.wrz", "wb");
00041     file = gzdopen(_fileno( stdout ), "wb");
00042     if (file == NULL) {
00043         fprintf(stderr, "gzdopen error\n");
00044         exit(1);
00045     }
00046         gzprintf(file,"%s%n", "-----",&printPos);
00047 
00048     for (i=0;i<10;i++) {
00049                 gzprintf(file," %d%n",printPos,&printPosInc);
00050                 printPos+=printPosInc;
00051         }
00052 
00053     gzclose(file);
00054 
00055     exit(0);
00056     return 0; /* to avoid warning */
00057 }

Generated on Thu Aug 7 16:18:59 2008 for elphel by  doxygen 1.5.1