I was wondering if there is a way to append data to a file without using functions from standard I/O libraries (i.e. stdio.h
). I though of doing something like this first:
#include <fcntl.h>
#include <unistd.h>
int main() {
int fd = open("test.txt", O_WRONLY | O_CREAT, 0700);
ssize_t wr = write(fd, "hello world", sizeof("hello world");
}
But this only writes data to the file without appending it so instead repeatedly displaying "hello world", it only overwrites the previous data and displays it once. Can someone please help me out? Thanks