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

Function create_file

test/unistd/unlink.c:17–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15#include <sys/stat.h>
16
17static void create_file(const char *path, const char *buffer, int mode) {
18 printf("creating: %s\n", path);
19 int fd = open(path, O_WRONLY | O_CREAT | O_EXCL, mode);
20 assert(fd >= 0);
21
22 int err = write(fd, buffer, sizeof(char) * strlen(buffer));
23 assert(err == (sizeof(char) * strlen(buffer)));
24
25 close(fd);
26}
27
28void setup() {
29 mkdir("working", 0777);

Callers 1

setupFunction · 0.70

Calls 6

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

Tested by

no test coverage detected