C reading from a live file ( file keep growing in size )
Asked Answered
P

1

2

I have an application that is recording live , the capture file keep growing in size using fread() and feof() , but feof() is breaking the loop early , so what's the best technique to keep reading from the stream

  • should I wait and then I can advance the file stream ?
  • should I open the file again and advance to position by calculating the total of read bytes?
  • maybe something else ?

the code will have to read the file , build a packet and send it packaging and sending is going well with fixed size files

Parttime answered 23/10, 2011 at 6:47 Comment(0)
C
2

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

Convict answered 23/10, 2011 at 6:51 Comment(1)
well at the receiving side , do you know any simple video playback program written in C so I can implement select there too ?Parttime

© 2022 - 2024 — McMap. All rights reserved.