PatchworkOS  19e446b
A non-POSIX operating system.
Loading...
Searching...
No Matches
swritefile.c
Go to the documentation of this file.
1#include <string.h>
2#include <sys/fs.h>
3
4size_t writefiles(const char* path, const char* string)
5{
6 fd_t fd = open(path);
7 if (fd == ERR)
8 {
9 return ERR;
10 }
11 uint64_t totalWritten = writes(fd, string);
12 close(fd);
13 return totalWritten;
14}
fd_t open(const char *path)
System call for opening files.
Definition open.c:8
size_t writefiles(const char *path, const char *string)
Wrapper for writing a null-terminated string directly to a file using a path.
Definition swritefile.c:4
uint64_t close(fd_t fd)
System call for closing files.
Definition close.c:8
size_t writes(fd_t fd, const char *string)
Wrapper for writing a null-terminated string to a file.
Definition swrite.c:4
#define ERR
Integer error value.
Definition ERR.h:17
__UINT64_TYPE__ fd_t
File descriptor type.
Definition fd_t.h:10
__UINT64_TYPE__ uint64_t
Definition stdint.h:17