OpenClonk
gunzip4c4group.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007, Günther Brammer
3  * Copyright (c) 2010-2016, The OpenClonk Team and contributors
4  *
5  * Distributed under the terms of the ISC license; see accompanying file
6  * "COPYING" for details.
7  *
8  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
9  * See accompanying file "TRADEMARK" for details.
10  *
11  * To redistribute this file separately, substitute the full license texts
12  * for the above references.
13  */
14 
15 #include "C4Include.h"
16 #include "c4group/CStdFile.h"
17 
18 bool EraseItemSafe(const char *szFilename)
19 {
20  return false;
21 }
22 
23 int main(int argc, char *argv[])
24 {
25  if (argc < 2)
26  {
27  fprintf(stderr, "%s infile [outfile]", argv[0]);
28  return 1;
29  }
30  CStdFile MyFile;
31  MyFile.Open(argv[1], true);
32  char Data [4096];
33  size_t iSize;
34  if (argc < 3)
35  {
36  do
37  {
38  MyFile.Read(Data,sizeof(Data),&iSize);
39  fwrite(Data, 1, iSize, stdout);
40  }
41  while(iSize);
42  }
43  else
44  {
45  CStdFile OutFile;
46  OutFile.Create(argv[2], false);
47  do
48  {
49  MyFile.Read(Data,sizeof(Data),&iSize);
50  OutFile.Write(Data, iSize);
51  }
52  while(iSize);
53  OutFile.Close();
54  }
55  MyFile.Close();
56 }
int iSize
Definition: TstC4NetIO.cpp:32
bool Close(StdBuf **ppMemory=nullptr)
Definition: CStdFile.cpp:151
bool Create(const char *szFileName, bool fCompressed=false, bool fExecutable=false, bool fMemory=false)
Definition: CStdFile.cpp:49
bool Write(const void *pBuffer, int iSize)
Definition: CStdFile.cpp:240
bool Read(void *pBuffer, size_t iSize) override
Definition: CStdFile.h:60
bool Open(const char *szFileName, bool fCompressed=false)
Definition: CStdFile.cpp:95
int main(int argc, char *argv[])
bool EraseItemSafe(const char *szFilename)