PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
phoenix_getFileSize.h File Reference
#include <stdio.h>
#include <string>
+ Include dependency graph for phoenix_getFileSize.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

size_t phoenix_getFileSize (const std::string &fileName)
 Get the size of the given file in bytes. More...
 
size_t phoenix_getFileSize (FILE *fs)
 Get the size of the given file in bytes. More...
 

Function Documentation

◆ phoenix_getFileSize() [1/2]

size_t phoenix_getFileSize ( const std::string &  fileName)

Get the size of the given file in bytes.

Parameters
fileName: file to be used
Returns
size of the given file in bytes

Definition at line 27 of file phoenix_getFileSize.cpp.

27  {
28  FILE* compressedFs = fopen(fileName.c_str(), "r");
29  if(compressedFs == NULL){
30  return 0lu;
31  }
32  size_t fileSize(phoenix_getFileSize(compressedFs));
33  fclose(compressedFs);
34  return fileSize;
35 }

References phoenix_getFileSize().

+ Here is the call graph for this function:

◆ phoenix_getFileSize() [2/2]

size_t phoenix_getFileSize ( FILE *  fs)

Get the size of the given file in bytes.

Parameters
fs: file to be used
Returns
size of the given file in bytes

Definition at line 14 of file phoenix_getFileSize.cpp.

14  {
15  //Then the number of compressed bytes
16  //Get and save the number of bytes of the compressed file
17  fseek(fs, 0, SEEK_END);
18  size_t fileSize(ftell(fs));
19  fseek(fs, 0, SEEK_SET);
20  return fileSize;
21 }

Referenced by phoenix_getFileSize(), and testStringFileSize().

+ Here is the caller graph for this function:
phoenix_getFileSize
size_t phoenix_getFileSize(FILE *fs)
Get the size of the given file in bytes.
Definition: phoenix_getFileSize.cpp:14