Passing file contents through a bidirectional pipe Passing file contents through a bidirectional pipe unix unix

Passing file contents through a bidirectional pipe


In the C program, you have to create a buffer to read the file into and then send that to the pipe. If the buffer is smaller than the file, you need multiple reads. The pipe may not take the full write in one gulp so you may need multiple writes. This is usually done with an outer loop that reads some data and then an inner loop that writes the data... then repeat until the file transfer is done. – tdelaney