MCPcopy Create free account
hub / github.com/couchbase/fleece / writeToFile

Function writeToFile

Fleece/Support/sliceIO.cc:58–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56 }
57
58 void writeToFile(slice s, const char *path, int mode) {
59 int fd = ::_open(path, mode | O_WRONLY | O_BINARY, 0600);
60 if (fd < 0)
61 FleeceException::_throwErrno("Can't open file");
62 ssize_t written = narrow_cast<ssize_t>(::_write(fd, s.buf, narrow_cast<unsigned int>(s.size)));
63 if(written < narrow_cast<ssize_t>(s.size))
64 FleeceException::_throwErrno("Can't write file");
65 ::_close(fd);
66 }
67
68 void writeToFile(slice s, const char *path) {
69 writeToFile(s, path, O_CREAT | O_TRUNC);

Callers 4

EncoderTests.ccFile · 0.85
SupportTests.ccFile · 0.85
PerfTests.ccFile · 0.85
appendToFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected