Exforsys
+ Reply to Thread
Results 1 to 2 of 2

circular buffer

This is a discussion on circular buffer within the C and C++ forums, part of the Programming Talk category; Hi, I have a program which reads the data from a webcam connected to a linux m/c and writes the ...

  1. #1
    itzsug is offline Junior Member Array
    Join Date
    May 2004
    Answers
    22

    circular buffer

    Hi,

    I have a program which reads the data from a webcam connected to a linux m/c and writes the data to a file. The problem with this is the file size grows as i capture the data. Instead i want to this using a circular buffer. how can i do this?

    plz kindly suggest me.

    Thanks
    Jagadish


  2. #2
    dhee Guest

    Re:circular buffer

    my intuition would be to have a linked list of memory segments which are allocated as data
    is being read from the webcam. (It should be a fixed buffer size if you are reading it
    directly from the device.)

    use successive nodes to read the data and keep freeing the nodes which have stale data.

    If you MUST write the data to a file then you could extend the above to a file analogy as in
    writing it to multiple files and deleting them as the need expires. OF course, this would be a rather lousy way to do things.

    dhee


Latest Article

Network Security Risk Assessment and Measurement

Read More...