Pipes

Description

Plot.c makes four file descriptors that are temporary files, it sends f1(i)=sin(1/i)f_1(i)=sin(1/i), f2(i)=sin(i)f_2(i)=sin(i), f3(i)=0.5f_3(i)=0.5, f4(i)=rand()f_4(i)=rand() values to gnuplot infinitely.

First off, the program opens a process popen(command) -pipe, fork, and process descriptor called plot 1 and plot 2-, then gnuplot plot them and replot again each 250 ms when program calls PlotOne() that writes new values on files and gnuplot read them.

The program can stop when the user presses ctrl+c, so quit() is called; it removes files with another process popen(deletefiles, "w"); and closes file descriptors.

Screenshot