I try to change the code from while(..) to do{.. } while(..) .. it works..
do
{
c[0]=fgetc(fin); // get each character from inputfile
write(fd[1],c,2); // write to pipe
}
while(c[0]!=EOF)
and it's work.. but wrong result.. Because the last c[0] = EOF, it is written to pipe, then while loop check the codition.. ( wrong ofcourse)..
I include if statement like this:
if(c[0]!= EOF)
{
c[0]=fgetc(fin);// get each character from inputfile
write(fd[1],c,2); // write to pipe
}
Problem again.. The output is blank.. so crazy.. please help me..