Click here to Skip to main content
16,011,120 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DirectX CreateSurface question Pin
Antony M Kancidrowski14-Oct-04 4:12
Antony M Kancidrowski14-Oct-04 4:12 
GeneralRe: DirectX CreateSurface question Pin
Cedric Moonen14-Oct-04 4:31
Cedric Moonen14-Oct-04 4:31 
GeneralRe: DirectX CreateSurface question Pin
Antony M Kancidrowski14-Oct-04 4:57
Antony M Kancidrowski14-Oct-04 4:57 
GeneralRe: DirectX CreateSurface question Pin
Cedric Moonen14-Oct-04 20:40
Cedric Moonen14-Oct-04 20:40 
GeneralRe: DirectX CreateSurface question Pin
John M. Drescher14-Oct-04 6:32
John M. Drescher14-Oct-04 6:32 
Generalhow:enumerate remote PCs Pin
happycpp14-Oct-04 1:52
happycpp14-Oct-04 1:52 
GeneralRe: how:enumerate remote PCs Pin
David Crow14-Oct-04 2:32
David Crow14-Oct-04 2:32 
GeneralMemory Mapped Files: Hadling Big Files Pin
krabhinav14-Oct-04 1:51
krabhinav14-Oct-04 1:51 
Hello All,

I am trying to memory mappin technique to parse zone file. The program is running fine for small file of size around 350MB but the same program failes when the file size becomes 2.5GB

Here is a simple program which works fine for small files but fails for large files:


#include <windows.h><br />
#include<stdio.h><br />
<br />
<br />
<br />
int main(void)<br />
{<br />
<br />
char * p1stData;<br />
HANDLE hMap1stFile;	<br />
HANDLE h1stFile;	<br />
LPVOID lp1stMapAddress;		<br />
h1stFile = CreateFile("biz.zone", GENERIC_READ | GENERIC_WRITE, 0, NULL,<br />
                     OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);<br />
 if (h1stFile == INVALID_HANDLE_VALUE)<br />
  {<br />
    printf("h1stFile is NULL\n");<br />
    printf("Target file is %s\n", "biz.zone");<br />
    return 4;<br />
  }<br />
 hMap1stFile = CreateFileMapping( h1stFile,          // current file handle<br />
                NULL,           // default security<br />
                PAGE_READWRITE, // read/write permission<br />
                0,              // size of mapping object, high<br />
                0,//dwFileMapSize,  // size of mapping object, low<br />
                NULL);          // name of mapping object<br />
<br />
  if (hMap1stFile == NULL) <br />
  {<br />
    printf("hMap1stFile is NULL: last error: %d\n", GetLastError() );<br />
    return (2);<br />
  }<br />
 lp1stMapAddress = MapViewOfFile(hMap1stFile,				 // handle to mapping object<br />
                               FILE_MAP_ALL_ACCESS,			// read/write permission <br />
                               0,							// high-order 32 bits of file offset<br />
                               0,//dwFileMapStart,				// low-order 32 bits of file offset<br />
                               0);							// number of bytes to map<br />
  if (lp1stMapAddress == NULL) <br />
  {<br />
    printf("lp1stMapAddress is NULL: last error: %d\n", GetLastError());<br />
    return 3;<br />
  }<br />
<br />
 <br />
  p1stData = (char *) lp1stMapAddress;//+ iViewDelta;<br />
<br />
<br />
  for(int i=0;i<1000;i++)<br />
  {<br />
	  printf("%c",*p1stData);<br />
  }<br />
  return 0;<br />
  }


The error that comes is:

hMap1stFile is NULL: last error: 1006

Is there any upper limit on the file size which can be memory mapped.


dotcom
GeneralRe: Memory Mapped Files: Hadling Big Files Pin
David Crow14-Oct-04 2:41
David Crow14-Oct-04 2:41 
GeneralAdding accelerator keys to Buttons and Toolbars Pin
ledallam14-Oct-04 1:39
ledallam14-Oct-04 1:39 
GeneralRe: Adding accelerator keys to Buttons and Toolbars Pin
Sujan Christo14-Oct-04 2:03
Sujan Christo14-Oct-04 2:03 
GeneralRe: Adding accelerator keys to Buttons and Toolbars Pin
ledallam14-Oct-04 18:21
ledallam14-Oct-04 18:21 
GeneralRegarding Modeless dialog Pin
balajeedurai14-Oct-04 1:14
balajeedurai14-Oct-04 1:14 
GeneralRe: Regarding Modeless dialog Pin
Sujan Christo14-Oct-04 2:06
Sujan Christo14-Oct-04 2:06 
GeneralRe: Regarding Modeless dialog Pin
balajeedurai14-Oct-04 2:49
balajeedurai14-Oct-04 2:49 
GeneralRe: Regarding Modeless dialog Pin
BlackDice14-Oct-04 6:21
BlackDice14-Oct-04 6:21 
QuestionAccept incoming TCP connections when logged off? Pin
One Stone14-Oct-04 0:35
One Stone14-Oct-04 0:35 
AnswerRe: Accept incoming TCP connections when logged off? Pin
Bob Stanneveld14-Oct-04 1:13
Bob Stanneveld14-Oct-04 1:13 
Generalpush-like check box Pin
jooo13-Oct-04 23:33
jooo13-Oct-04 23:33 
Generalsql server import /export access in vc++ code Pin
tgprakash13-Oct-04 23:21
tgprakash13-Oct-04 23:21 
GeneralRe: sql server import /export access in vc++ code Pin
rabih_kai13-Oct-04 23:38
rabih_kai13-Oct-04 23:38 
GeneralRe: sql server import /export access in vc++ code Pin
tgprakash14-Oct-04 1:28
tgprakash14-Oct-04 1:28 
GeneralRe: sql server import /export access in vc++ code Pin
rabih_kai14-Oct-04 3:12
rabih_kai14-Oct-04 3:12 
GeneralRe: sql server import /export access in vc++ code Pin
tgprakash14-Oct-04 4:04
tgprakash14-Oct-04 4:04 
GeneralRe: sql server import /export access in vc++ code Pin
rabih_kai14-Oct-04 5:53
rabih_kai14-Oct-04 5:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.