I\'m writing a program that reads in a loop from the stdin, using the function fgets, as follows:
while(fgets(buffer2, BUFFERSIZE , stdin) != NULL){ //So
On Linux, you can specify the end of input by pressing ctrl-d, and of-course you can do this using separate thread.