Hi, i'm currently using the CreateFile and ReadFile functions in my program. I need to read in large chunks of data really fast. But i'm having some trouble with the functions.
I'm currently using the FILE_FLAG_NO_BUFFERING, because i need the speed.
The problem is that the readFile only works if i read in exactly 518400*2 bytes, any less the function fails.
I need this value to be dynamic, i.e i'm reading in frames, each frame is width*height*1.5 bytes.
If anyone who is fimilar with these functions could help me out or suggest another function of would be greatly appreciated.
Code:
videoYUV=CreateFile("C:\\Documents and Settings\\mliu\\Desktop\\YUVPLAYER\\pond.yuv", GENERIC_READ, FILE_SHARE_READ,NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_NO_BUFFERING ,NULL);
for(int k=0;k<5;k++)
{
ReadFile(videoYUV,YP[k],518400*2,&bytesread,&gOverLapped);
gOverLapped.Offset+=518400*2;
}
I'm currently using the FILE_FLAG_NO_BUFFERING, because i need the speed.
The problem is that the readFile only works if i read in exactly 518400*2 bytes, any less the function fails.
I need this value to be dynamic, i.e i'm reading in frames, each frame is width*height*1.5 bytes.
If anyone who is fimilar with these functions could help me out or suggest another function of would be greatly appreciated.