MCPcopy Create free account
hub / github.com/computationalpathologygroup/ASAP / readFile

Function readFile

core/filetools.cpp:816–831  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

814
815//---------------------------------------------------------------------------
816 bool readFile(const std::string &filename, std::string &s)
817 {
818 long n = fileSize(filename);
819 if (n == -1)
820 return false;
821 FILE *fpIO = fopen(filename.c_str(), "rb");
822 if (fpIO == NULL)
823 return false;
824 s.clear();
825 s.resize(n);
826 //char *in = new char[n];
827 long bytes = static_cast<long>(fread(&(s[0]), sizeof(char), n, fpIO));
828 //delete in;
829 fclose(fpIO);
830 return (bytes == n);
831 }
832
833//---------------------------------------------------------------------------
834 bool readFile(const std::string &filename, std::vector<std::string> &vs)

Callers

nothing calls this directly

Calls 5

fileSizeFunction · 0.85
splitFunction · 0.85
sizeMethod · 0.80
emptyMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected