I am unable to replicate your error as you didn't include the full source (function Fx
and definitions of pos
and v
). You are calling the wrong close. You should call fclose()
(this will flush the file handle too).
fclose(pipe)
And not
close(pipe)
You could explicitly flush the data by calling fflush()
.