HIK2016/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 149 of file hikdump_std.inl.

150 {
151  // Read all the data
152  bool bResult = false;
153  FILE* lFile = NULL;
154 #if !defined(_MSC_VER) || (_MSC_VER == 1500)
155  lFile = fopen(pFileName, "rb");
156 #else
157  fopen_s(&lFile, pFileName, "rb");
158 #endif
159  if(lFile != NULL)
160  {
161  bResult = pStream.Read(lFile);
162  fclose(lFile);
163  }
164 
165  return bResult;
166 }
#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 168 of file hikdump_std.inl.

169 {
170  // Read all the data
171  bool bResult = false;
172  FILE* lFile = NULL;
173 #if !defined(_MSC_VER) || (_MSC_VER == 1500)
174  lFile = fopen(pFileName, "rb");
175 #else
176  fopen_s(&lFile, pFileName, "rb");
177 #endif
178  if(lFile != NULL)
179  {
180  fseek(lFile, pOffset, 0);
181  bResult = fread(pStream, pElementSize, pElementCount, lFile) > 0 ;
182  fclose(lFile);
183  }
184 
185  return bResult;
186 }
#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 = NULL;
117 #if !defined(_MSC_VER) || (_MSC_VER == 1500)
118  lFile = fopen(pFileName, "wb+");
119 #else
120  fopen_s(&lFile, pFileName, "wb+");
121 #endif
122  if(lFile != NULL)
123  {
124  pStream.Write(lFile);
125  fclose(lFile);
126  return true;
127  }
128  return false;
129 }
#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 131 of file hikdump_std.inl.

132 {
133  // Save all the collected data
134  FILE* lFile = NULL;
135 #if !defined(_MSC_VER) || (_MSC_VER == 1500)
136  lFile = fopen(pFileName, "ab+");
137 #else
138  fopen_s(&lFile, pFileName, "ab+");
139 #endif
140  if(lFile != NULL)
141  {
142  fwrite(pStream, pElementSize, pElementCount, lFile);
143  fclose(lFile);
144  return true;
145  }
146  return false;
147 }
#define NULL
Definition: kaydara.h:179
char char int FILE
Definition: fileobject.h:45

Go to the source code of this file.