MCPcopy Create free account
hub / github.com/WheretIB/nullc / FileReadArr

Function FileReadArr

NULLC/includes/file.cpp:193–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191 return res;
192 }
193 void FileReadArr(NULLCArray arr, unsigned offset, unsigned count, File* file)
194 {
195 if(!file->handle)
196 {
197 nullcThrowError("Cannot read from a closed file.");
198 return;
199 }
200 if((long long)count + offset > arr.len)
201 {
202 nullcThrowError("Array can't hold %d bytes from the specified offset.", count);
203 return;
204 }
205 if(count != fread(arr.ptr + offset, 1, count, file->handle))
206 nullcThrowError("Failed to read from a file.");
207 }
208 void FileWriteArr(NULLCArray arr, unsigned offset, unsigned count, File* file)
209 {
210 if(!file->handle)

Callers

nothing calls this directly

Calls 1

nullcThrowErrorFunction · 0.50

Tested by

no test coverage detected