X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;ds=sidebyside;f=src%2Fprocess2.c;h=4db50e07f72c1ad7593bbfd6f8ef7aad9a568088;hb=edc26e7336f1ee79ab0ca631dbab8e791812fd21;hp=327ad8e1a6121f450cee410ee7e0de2d3c62b910;hpb=d9503d0855f3cc3b422c496dfa01b56eb6cee357;p=wsti_so.git diff --git a/src/process2.c b/src/process2.c index 327ad8e..4db50e0 100644 --- a/src/process2.c +++ b/src/process2.c @@ -17,12 +17,24 @@ int main(void) { /** Named pipe used to communicate with process3 */ char * write_pipe = "/tmp/process2pipe"; + /** Descriptor of input pipe */ int read_descriptor; + + /** Descriptor of output pipe */ int write_descriptor; - + + /** + * Buffer used for storing data from input pipe. + * Data is stored in chunks of BUFFER_STEP size. + * If data during reading is bigger than this value, then number of + * characters is saved, and buffer is cleared for reading another chunk. + */ char buffer[BUFFER_STEP]; - + + /** Index used when iterating buffer */ int i = 0; + + /** Stores number of bytes read from input pipe in current iteration */ ssize_t count = 0; /* Reading from process1 */