OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
gunzip4c4group.cpp File Reference
#include "C4Include.h"
#include "c4group/CStdFile.h"
#include <stdio.h>
Include dependency graph for gunzip4c4group.cpp:

Go to the source code of this file.

Functions

bool EraseItemSafe (const char *szFilename)
 
int main (int argc, char *argv[])
 

Function Documentation

bool EraseItemSafe ( const char *  szFilename)

Definition at line 19 of file gunzip4c4group.cpp.

20 {
21  return false;
22 }
int main ( int  argc,
char *  argv[] 
)

Definition at line 24 of file gunzip4c4group.cpp.

References CStdFile::Close(), CStdFile::Create(), iSize, CStdFile::Open(), CStdFile::Read(), and CStdFile::Write().

25 {
26  if (argc < 2)
27  {
28  fprintf(stderr, "%s infile [outfile]", argv[0]);
29  return 1;
30  }
31  CStdFile MyFile;
32  MyFile.Open(argv[1], true);
33  char Data [4096];
34  size_t iSize;
35  if (argc < 3)
36  {
37  do
38  {
39  MyFile.Read(Data,sizeof(Data),&iSize);
40  fwrite(Data, 1, iSize, stdout);
41  }
42  while(iSize);
43  }
44  else
45  {
46  CStdFile OutFile;
47  OutFile.Create(argv[2], false);
48  do
49  {
50  MyFile.Read(Data,sizeof(Data),&iSize);
51  OutFile.Write(Data, iSize);
52  }
53  while(iSize);
54  OutFile.Close();
55  }
56  MyFile.Close();
57 }
bool Close(StdBuf **ppMemory=nullptr)
Definition: CStdFile.cpp:155
bool Create(const char *szFileName, bool fCompressed=false, bool fExecutable=false, bool fMemory=false)
Definition: CStdFile.cpp:53
bool Write(const void *pBuffer, int iSize)
Definition: CStdFile.cpp:244
bool Read(void *pBuffer, size_t iSize) override
Definition: CStdFile.h:61
bool Open(const char *szFileName, bool fCompressed=false)
Definition: CStdFile.cpp:99
int iSize
Definition: TstC4NetIO.cpp:35

Here is the call graph for this function: