c - Making file wrap around when using fwrite -



c - Making file wrap around when using fwrite -

i using embedded scheme running linux.i utilize ramdisk filesystem on embedded target. application captures real-time info , standard c "fwrite" file in ramdisk fs.as there limited amount of memory , set max size file , cause fwrite wrap around circular buffer. there way in manner transparent application ? prefer application remain unchanged when migrate filesystem on storage device (esata) having much larger capacity.

there's no built in method of achieving this.

the best alternative write little wrapper function takes care of file write while maintaining count of number of bytes written.

once has reached maximum size set should phone call rewind() (or fseek() etc.) go start of file.

it might easier utilize mmap() memory map file , treat circular buffer. 1 time again need implement wrapping yourself.

c linux embedded ramdisk

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -