Your program is written incorrectly. There are two ways to read from a thread (or write) safe queue. You can do it by a pointer to the internal queue memory, or you can do it by reading (or writing) a local copy.
You are reading by pointer and then copying to a local copy. You should just read directly with CmtReadTSQData since you want a local copy anyway and read directly into buff1.
If you want to read by pointer, you have to release the pointer with CmtReleaseTSQReadPtr after you are done with the pointer. And you do not need to call CmtFlushTSQ. The queue will automatically remove the data once it has been read off.
So your code should look something like:
int tes=bmQuePtr->getTSQHandle();
int numItems,status,status1,status2,status3,i
tems;
unsigned int *readptr;
unsigned int buff1[5000];
while(1)
{
Sleep(100);
numItems=0;
CmtGetTSQAttribute (tes, ATTR_TSQ_ITEMS_IN_QUEUE, &numItems);
if(numItems != 0)
status=CmtReadTSQData(tes,buff1, numItems, TSQ_INFINITE_TIMEOUT, 0);
}
Best Regards,
Chris Matthews
National Instruments