C reading from a live file (the file continues to grow in size)

I have an application that writes live, the capture file continues to grow in size using fread () and feof (), but feof () breaks the loop early, so the best way to keep reading from the stream

  • Do I have to wait and then can I promote the file stream?
  • Should I open the file again and go to the position, calculating the total number of bytes read?
  • maybe something else?

the code will need to read the file, assemble the package and send it packing and sending goes well with files with a fixed size.

+2
source share
1 answer

I would track the file (something like select(2) ). When I notified this, I would read as much as possible and then wait again.

+2
source

All Articles