Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Name pipe
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <sys/types.h> #include <sys/uio.h> #include <unistd.h> #define MAX_LINE_LENGTH int main(int argc, char *argv[]) { int pipe; char ch; /* we expect a named pipe has been created * in /tmp/named_pipe . The command * $ mkfifo /tmp/named_pipe * is a friend to get to this point */ pipe = open("/tmp/named_pipe", O_RDONLY); if (pipe < 0) { perror("Opening pipe"); exit(1); } /* preparing to read from the pipe... */ printf("Waiting data from the pipe... \n"); /* reading one char a time from the pipe */ while (1) { if (read(pipe, &ch, 1) < 0) { perror("Read the pipe"); exit(2); } printf("%c", ch); } /* leaving the pipe */ close(pipe);
run
|
edit
|
history
|
help
0
WAP in C to convert decimal to binary
Galgotia university
HW4e5
1.3 Max threads
Lab 9 v0.95
3850
C_141112_Perfectos
Project 3 Part 1 v1.75
CO Assignment 1 Question 4
Part 1: Draw Arts