PatchworkOS  966e257
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/io.h>
3
4uint64_t swritefile(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 = swrite(fd, string);
12 close(fd);
13 return totalWritten;
14}
fd_t open(const char *path)
System call for opening files.
Definition open.c:9
uint64_t close(fd_t fd)
System call for closing files.
Definition close.c:9
uint64_t swrite(fd_t fd, const char *string)
Wrapper for writing a null-terminated string to a file.
Definition swrite.c:4
uint64_t swritefile(const char *path, const char *string)
Wrapper for writing a null-terminated string directly to a file using a path.
Definition swritefile.c:4
#define ERR
Integer error value.
Definition ERR.h:17
__UINT64_TYPE__ fd_t
A file descriptor.
Definition fd_t.h:12
__UINT64_TYPE__ uint64_t
Definition stdint.h:17