MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / getSize

Function getSize

TactilityCore/Source/file/File.cpp:126–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124
125
126long getSize(FILE* file) {
127 long original_offset = ftell(file);
128
129 if (fseek(file, 0, SEEK_END) != 0) {
130 LOGGER.error("fseek failed");
131 return -1;
132 }
133
134 long file_size = ftell(file);
135 if (file_size == -1) {
136 LOGGER.error("Could not get file length");
137 return -1;
138 }
139
140 if (fseek(file, original_offset, SEEK_SET) != 0) {
141 LOGGER.error("fseek Failed");
142 return -1;
143 }
144
145 return file_size;
146}
147
148/** Read a file.
149 * @param[in] filepath

Callers 2

readBinaryInternalFunction · 0.85
openMethod · 0.85

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected