Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Name pipe
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#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);
gcc
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 0.15 sec, absolute service time: 0,21 sec
edit mode
|
history
|
discussion