I have a large plain text file with size of 20GB on disk. Lets name this file as "MyFile.txt". This file contains only english languge words and one string with value of "+++". Lets name this string as FlagString. From the beginig of MyFile.txt to FlagString there are correct english words. Lets call this section of file as Dictionary. But from first word after FlagString to the end of MyFile.txt the words can be with misspells. Lets call this section of file as CheckedSection. I must read each word from checked section and validate spelling of this word to compare it with appropriate word in Dictionary in compliance with some algorithm. If MyFile.txt is large I'd like to use CreateFileMapping and MapViewOfFile functions to map file into memory. My problem is the following:
- MyFile.txt is large so I want to map it fragmentary in memory. Let each fragment has size of 1GB. Please help me how to map file fragmentary in memory using CreateFileMapping.
- How can I identify FlagString as delimiter between Dictionary and CheckedSection when I use fragmentary file mapping into memory. FlagString in MyFile.txt may be not obligatory on 1GB section border but it may be inside 1GB section. Is there any file cursor that I use to mark position in file after file has been mapped in memory?
- Can I create two memory mappings from MyFile.txt? One mapping for Dictionary and another mapping for CheckedSection.
- Must I call UnmapViewOfFile and CloseHandle each time when I finished processing of current 1GB section of Dictionary or CheckedSection?