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 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 18 of file gunzip4c4group.cpp.

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

Definition at line 23 of file gunzip4c4group.cpp.

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

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 }
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 iSize
Definition: TstC4NetIO.cpp:32

Here is the call graph for this function: