0
Reply

How to do Multiple view using MapViewOFFile API .

jaffersaleem

jaffersaleem

Mar 9 2005 2:27 AM
4.7k
Hi I want to do multiple view to a binary file using MapViewOFFile API . Requirement: I have to process 3 GB file very sequentially .Each time I want to map a view of 100MB data.The first view starts from begin of the file and from second to last view go very sequentially. [From 0 to 100MB(first view) ,101 to 200(second view),201 to 300 (third view).... end of file] After doing the multiple view I am not able to move the pointers.If I move the pointer ,it is referring bad pointer. I have put my code here Loop { SYSTEM_INFO si; GetSystemInfo(&si); DWORD chunkStart =(DWORD) StartingPosition - (StartingPosition % si.dwAllocationGranularity); DWORD dsNumberOfBytes =NumberOfBytes+ StartingPosition - chunkStart; //map the view from mapped file. SequenceOFByte = (unsigned char *) MapViewOfFile ( hMapFile, FILE_MAP_READ, 0,chunkStart,dsNumberOfBytes); if (SequenceOFByte == NULL) { CloseHandle(hMapFile); CloseHandle(hFile); printf("Couldn't map view of file with MapViewOfFile()\n"); return; } DataProcessing(SequenceOFByte ); } Please give the solution. Regards Jaffer