Files
zvfs/test_so/test_so.c
2024-08-10 12:24:02 +00:00

30 lines
411 B
C
Executable File

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
// posix
int main() {
int fd = open("a.txt", O_CREAT | O_RDWR);
char *buffer = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
write(fd, buffer, strlen(buffer));
char rbuffer[128] = {0};
read(fd, buffer, 128);
printf("rbuffer: %s\n", buffer);
close(fd);
}