I have the following code:
int buffer_max_size = 1024;
char* buffer = new char[buffer_max_size]
FILE* cout_file = fdopen(cout_pipe[0], "r");
while (fread( &buffer[0], sizeof(char),sizeof(char)*buffer_max_size, cout_file) != 0 )
{...}
cout_file is of type FILE* and is connected to a binary's stdout. That binary outputs some text on its std_out at 5 sec intervals.
It seems that fread is blocking until the cout_file contains buffer_max_size bytes.. Is that normal?
I would like to be able to read what is in the pipe right now without blocking.. Is that possible?