Files
OS/lab6/pipe_write.c
2025-04-23 23:07:22 +08:00

18 lines
334 B
C

#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
int main() {
int fd = open("/dev/wendy_in", O_WRONLY);
if (fd < 0) {
printf("Error open pipe");
return 1;
}
const char *msg = "Hello from the other side!\n";
write(fd, msg, strlen(msg));
close(fd);
return 0;
}