I have written a program which reads data in blocks from a hard disk and processes the blocks looking for certain data.
In order to try and increase the speed I have changed to overlapped I/O, however I am struggling to 'switch' the buffer's after the reads.
So if I have 2 buffers Current and Next i would want to do the following:
Read data into Current
Start reading data into Next
Process data in Current
Check Next has read
Change Next to Current and Vice versa
Read into next
Process Data
......
Thanks in advance for any help
Has anyone got any ideas on how to switch the buffers?
current points to buffer A
next points to buffer B
begin next read into current
begin next read into next
loop
{
wait for current to become ready
process current
if (done)
break;
begin next read into current
swap current and next pointers
}
Thanks KBW, I have the rest of the code set up ready, but if I have:
unsigned char buffer1[4096], buffer2[4096];
How would I change them after so that buffer1 actually points to buffer2 and vice versa?
Would it be buffer2 = &buffer1?
Tried a few things but couldnt get it to work