30 lines
411 B
C
Executable File
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);
|
|
}
|
|
|
|
|
|
|
|
|