X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=src%2Fprocess3.c;h=4568d97d1e3c4ee1280221fbf7f23ef1cd7f57e2;hb=eb929ae1b11dc0dba139ae4ae2a45f00ff654621;hp=f06a381014d060f61d11baafe896d8d911b75282;hpb=517b77e6e4502dabfee542f17d91201ef04fedff;p=wsti_so.git diff --git a/src/process3.c b/src/process3.c index f06a381..4568d97 100644 --- a/src/process3.c +++ b/src/process3.c @@ -1,13 +1,8 @@ #include -#include -#include /* open/read/write/close */ #include -/** If buffer is too small to hold entire string, it is incremented by this value */ -#define BUFFER_STEP 16 - /** * Program grabs data (calculated number of characters) from process2 and prints * grabbed data to the standard output. @@ -16,18 +11,20 @@ int main(void) { /** Named pipe used to communicate with process2 */ char * read_pipe = "/tmp/process2pipe"; + /** Descriptor of input pipe */ int read_descriptor; - + + /** Buffer used for storing data from input pipe */ int buffer = 0; - int i = 0; + /** Stores number of bytes read from input pipe in current iteration */ ssize_t count = 0; /* Reading from process2 */ read_descriptor = open(read_pipe, O_RDONLY); - int number_of_characters = 0; - + fprintf(stderr, "[%s] Init!\n", "process3"); + while(1) { /* Read data from input pipe */ count = read(read_descriptor, &buffer, sizeof(int));