Question: As title, I use C to do this job between two programs in Linux system.
But, I encounter some problem.
Assuming that I have a server write data to FIFO in ten rounds, and
the client will read each round data and write another FIFO to feed 
back to server.
The client will block in each round until that the server writer data in.
However, my client program can't do this.

I use `fopen` to open the FIFO and `fgets` to read data.
It seems not to block to wait data write in.

client code:

```
FILE *fp_R,*fp_W;
char temp[100];
fp_R = fopen(FIFO_R,"rb");
fp_W = fopen(FIFO_W,"wb");
for ( i = 0 ; i < 10 ; i ++ ) {
   fgets(temp, 100, fp_R);
   Handle Data;
   fprintf(fp_W,DATA);
}

```

I want to `fgets` to wait for server writing data in, so that I can handle each round

Thanks for anyone help

Answer: 
as TonyB said, the `fopen()` function will return a file pointer `FILE*`

```
FILE *fp_R, *fp_W;
char temp[100];
fp_R = fopen(FIFO_R,"rb");
fp_W = fopen(FIFO_W,"wb");
for ( i = 0 ; i < 10 ; i ++ ) {
   char* ret = fgets(temp, 100, fp_R);
   while(ret == null)
   {
    Sleep(1);
   }
   Handle Data;
   fprintf(fp_W,DATA);
}

```
Add 1 line and try as below:

```
int fp_R,fp_W;
char temp[100];
fp_R = fopen(FIFO_R,"rb");
fp_W = fopen(FIFO_W,"wb");
for ( i = 0 ; i < 10 ; i ++ ) {
   sleep(1); or usleep(10);//try it fgets will wait for some time bcz of this
   fgets(temp, 100, fp_R);
   Handle Data;
   fprintf(fp_W,DATA);
}

```