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

Function FileWriteArr

NULLC/includes/file.cpp:208–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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)
211 {
212 nullcThrowError("Cannot write to a closed file.");
213 return;
214 }
215 if((long long)count + offset > arr.len)
216 {
217 nullcThrowError("Array doesn't contain %d bytes from the specified offset.", count);
218 return;
219 }
220 if(count != fwrite(arr.ptr + offset, 1, count, file->handle))
221 nullcThrowError("Failed to write to a file.");
222 }
223}
224
225#define REGISTER_FUNC(funcPtr, name, index) if(!nullcBindModuleFunction("std.file", (void(*)())NULLCFile::funcPtr, name, index)) return false;

Callers

nothing calls this directly

Calls 1

nullcThrowErrorFunction · 0.50

Tested by

no test coverage detected