"Fossies" - the Fresh Open Source Software Archive

Member "asymptote-2.61/prc/PRCTools/inflationMain.cc" (18 Nov 2019, 1479 Bytes) of package /linux/misc/asymptote-2.61.src.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "inflationMain.cc" see the Fossies "Dox" file reference documentation.

    1 /************
    2 *
    3 *   This file is part of a tool for reading 3D content in the PRC format.
    4 *   Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
    5 *
    6 *   This program is free software: you can redistribute it and/or modify
    7 *   it under the terms of the GNU Lesser General Public License as published by
    8 *   the Free Software Foundation, either version 3 of the License, or
    9 *   (at your option) any later version.
   10 *
   11 *   This program is distributed in the hope that it will be useful,
   12 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
   13 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14 *   GNU Lesser General Public License for more details.
   15 *
   16 *   You should have received a copy of the GNU Lesser General Public License
   17 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
   18 *
   19 *************/
   20 
   21 #include <cstdlib>
   22 #include <iostream>
   23 #include <iomanip>
   24 #include <fstream>
   25 #include "inflation.h"
   26 
   27 using namespace std;
   28 
   29 int main(int argc, char *argv[])
   30 {
   31   if(argc < 2)
   32   {
   33     cerr << "No file specified." << endl;
   34     return 1;
   35   }
   36 
   37   ifstream data(argv[1]);
   38 
   39   char *buff = NULL;
   40   int dataSize = decompress(data,buff);
   41 
   42   cout << hex;
   43 
   44   for(int i = 0; i < dataSize; ++i)
   45   {
   46     cout << ' ' << setw(2) << setfill('0')
   47         << static_cast<unsigned int>(static_cast<unsigned char>(buff[i]));
   48     if(i%16 == 15)
   49       cout << endl;
   50   }
   51   cout << endl << dec << dataSize << " bytes" << endl;
   52   free(buff);
   53 
   54   return 0;
   55 }