Ali Imran
July 4th, 2008, 04:07 AM
Hello gurus
Can anyone please provide be a complete example of writing large files fast using File Maping functions ?
Following code cause application level crash
char *out = "newfile.txt";
HANDLE fh_infile = CreateFile(out, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(fh_infile==NULL) return false;
HANDLE h = CreateFileMapping(fh_infile, NULL, PAGE_READWRITE, 0, filesize, NULL);
char *dat = (char*)MapViewOfFile(h, FILE_MAP_WRITE, 0, 0, filesize);
char *tempdata = "Here is the temporary data";
CopyMemory(dat, tempdata, strlen(tempdata)+1);
UnmapViewOfFile(dat);
CloseHandle(fh_infile);
Waiting or the kind reply.
regards
Can anyone please provide be a complete example of writing large files fast using File Maping functions ?
Following code cause application level crash
char *out = "newfile.txt";
HANDLE fh_infile = CreateFile(out, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(fh_infile==NULL) return false;
HANDLE h = CreateFileMapping(fh_infile, NULL, PAGE_READWRITE, 0, filesize, NULL);
char *dat = (char*)MapViewOfFile(h, FILE_MAP_WRITE, 0, 0, filesize);
char *tempdata = "Here is the temporary data";
CopyMemory(dat, tempdata, strlen(tempdata)+1);
UnmapViewOfFile(dat);
CloseHandle(fh_infile);
Waiting or the kind reply.
regards