Could anyone please tell me that in producer consumer problem, How one can read a line from file and store into buffer of size 10 ?
static char buf[10][256];
void *producer( void *var)
{
char line[256];
int i;
for(;;)
{
if(feof)
break;
for(i=0;i<10, i++)
buf = fgets(line,256, in); // what should be the correct coding here to read from file and store in buffer ?
if ( pushInBuffer( &buf ) )
fprintf( stderr, "Error Consuming" );
}
pthread_exit( 0 );
}