Hey Steven,
I would check out the DIdoubleBufPatternGen653x.C shipping example. This example will continue to read the digital inputs until it reaches the iLoopCount < iHalfBufsToRead. You could change this to be anything or nothing if you wanted it to run for ever, or at least until you called a break statement.
The tricky part is that you will be required to write this data to the file each time iHalfReady == 1. This means you need to have the file open and ready, so that you can just call sprintf or some write function, so that the data can be wrote to the file. 4MB/s is pretty fast for file IO, when your computer is already running at full blast.
piHalfBuffer will contain the newest data that needs to be written to the file. I would play around
with the buffer so that you are not getting errors about buffer over flows (meaning your computer was writting to the file, when it should have been getting information from the dio) yet small enough that you are not maxing out your ram (this will actually cause your program to run slower, because it will be to busy swapping out memory on the hard drive).
All the buffer is, is a spot on your computers memory that DAQ uses to transfer data to. Double buffer transfers are the fastest, because it allows you to be reading one buffer, while it is writing memory to the other half. Other wise you would have to continue to poll the buffer to see how much is full and just read it out as fast as you can.
I hope this helps.
Joshua