MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / create_file

Function create_file

test/stat/test_chmod.c:21–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19#include <sys/types.h>
20
21void create_file(const char *path, const char *buffer, int mode) {
22 int fd = open(path, O_WRONLY | O_CREAT | O_EXCL, mode);
23 assert(fd >= 0);
24
25 int err = (int)write(fd, buffer, sizeof(char) * strlen(buffer));
26 assert(err == (sizeof(char) * strlen(buffer)));
27
28 close(fd);
29}
30
31void setup() {
32 create_file("file", "abcdef", 0777);

Callers 1

setupFunction · 0.70

Calls 5

strlenFunction · 0.85
openFunction · 0.50
assertFunction · 0.50
writeFunction · 0.50
closeFunction · 0.50

Tested by

no test coverage detected