C \ c ++ fast reading and writing of large files
# Include <windows. h>
# Include <stdio. h >#include <iostream >#include <string> using namespace STD; int main () {handle FH; handle mapfileh; handle openmap; handle maphandle; FH = createfile ("C: \ cpp_000000.txt ", generic_read | generic_write, file_share_read, null, open_existing, file_attribute_normal, null); If (FH = invalid_handle_value) {cout <" error in createfile! "<Endl; return false;} mapfileh = createfilemapping (FH, null, page_readwrite, 0, 0," resource "); If (mapfileh = NULL) {cout <"error in createfilemapping! "<Endl;} openmap = openfilemapping (file_map_all_access, true," resource "); If (openmap = NULL) {cout <" error in openfilemapping! "<Endl;} maphandle = mapviewoffile (openmap, file_map_all_access, 0, 0, 0); If (maphandle = NULL) {cout <" error in mapviewoffile! "<Endl;} // process the data. Unmapviewoffile (maphandle); closehandle (openmap); closehandle (FH); Return 0 ;}