Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <gzstream.h>
00029 #include <iostream>
00030 #include <fstream>
00031 #include <stdlib.h>
00032
00033 int main( int argc, char*argv[]) {
00034 if ( argc != 3) {
00035 std::cerr << "Usage: " << argv[0] <<" <in-file> <out-file>\n";
00036 return EXIT_FAILURE;
00037 }
00038
00039 ogzstream out2;
00040 out2.open( argv[2]);
00041 if ( ! out2.good()) {
00042 std::cerr << "ERROR: Opening file `" << argv[2] << "' failed.\n";
00043 return EXIT_FAILURE;
00044 }
00045 out2.close();
00046 if ( ! out2.good()) {
00047 std::cerr << "ERROR: Closing file `" << argv[2] << "' failed.\n";
00048 return EXIT_FAILURE;
00049 }
00050
00051 ogzstream out( argv[2]);
00052 if ( ! out.good()) {
00053 std::cerr << "ERROR: Opening file `" << argv[2] << "' failed.\n";
00054 return EXIT_FAILURE;
00055 }
00056 std::ifstream in( argv[1]);
00057 if ( ! in.good()) {
00058 std::cerr << "ERROR: Opening file `" << argv[1] << "' failed.\n";
00059 return EXIT_FAILURE;
00060 }
00061 char c;
00062 while ( in.get(c))
00063 out << c;
00064 in.close();
00065 out.close();
00066 if ( ! in.eof()) {
00067 std::cerr << "ERROR: Reading file `" << argv[1] << "' failed.\n";
00068 return EXIT_FAILURE;
00069 }
00070 if ( ! out.good()) {
00071 std::cerr << "ERROR: Writing file `" << argv[2] << "' failed.\n";
00072 return EXIT_FAILURE;
00073 }
00074 return EXIT_SUCCESS;
00075 }
00076
00077
00078