HIK2014/humanik/hikdump_std.inl File Reference

hikdump_std.inl File Reference

Functions

template<typename type >
bool Write (const char *pFileName, const type &pStream)
 
template<typename type >
bool WriteBlock (const char *pFileName, const size_t &pElementSize, const size_t &pElementCount, type &pStream)
 
template<typename type >
bool Read (const char *pFileName, type &pStream)
 
template<typename type >
bool ReadBlock (const char *pFileName, const size_t pOffset, const size_t &pElementSize, const size_t &pElementCount, type &pStream)
 

Function Documentation

bool Read ( const char *  pFileName,
type pStream 
)

Definition at line 139 of file hikdump_std.inl.

140 {
141  // Read all the data
142  bool bResult = false;
143  FILE* lFile = fopen(pFileName, "rb");
144  if(lFile != NULL)
145  {
146  bResult = pStream.Read(lFile);
147  fclose(lFile);
148  }
149 
150  return bResult;
151 }
#define NULL
Definition: kaydara.h:179
char char int FILE
Definition: fileobject.h:45
bool ReadBlock ( const char *  pFileName,
const size_t  pOffset,
const size_t pElementSize,
const size_t pElementCount,
type pStream 
)

Definition at line 153 of file hikdump_std.inl.

154 {
155  // Read all the data
156  bool bResult = false;
157  FILE* lFile = fopen(pFileName, "rb");
158  if(lFile != NULL)
159  {
160  fseek(lFile, pOffset, 0);
161  bResult = fread(pStream, pElementSize, pElementCount, lFile) > 0 ;
162  fclose(lFile);
163  }
164 
165  return bResult;
166 }
#define NULL
Definition: kaydara.h:179
char char int FILE
Definition: fileobject.h:45
bool Write ( const char *  pFileName,
const type pStream 
)

Definition at line 113 of file hikdump_std.inl.

114 {
115  // Save all the collected data
116  FILE* lFile = fopen(pFileName, "wb+");
117  if(lFile != NULL)
118  {
119  pStream.Write(lFile);
120  fclose(lFile);
121  return true;
122  }
123  return false;
124 }
#define NULL
Definition: kaydara.h:179
char char int FILE
Definition: fileobject.h:45
bool WriteBlock ( const char *  pFileName,
const size_t pElementSize,
const size_t pElementCount,
type pStream 
)

Definition at line 126 of file hikdump_std.inl.

127 {
128  // Save all the collected data
129  FILE* lFile = fopen(pFileName, "ab+");
130  if(lFile != NULL)
131  {
132  fwrite(pStream, pElementSize, pElementCount, lFile);
133  fclose(lFile);
134  return true;
135  }
136  return false;
137 }
#define NULL
Definition: kaydara.h:179
char char int FILE
Definition: fileobject.h:45

Go to the source code of this file.