Click here to Skip to main content
15,899,314 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionmemory mapped Pin
sarfaraznawaz7-Mar-11 1:35
sarfaraznawaz7-Mar-11 1:35 
AnswerRe: memory mapped Pin
Niklas L7-Mar-11 1:41
Niklas L7-Mar-11 1:41 
GeneralRe: memory mapped Pin
sarfaraznawaz8-Mar-11 20:37
sarfaraznawaz8-Mar-11 20:37 
GeneralRe: memory mapped Pin
Niklas L9-Mar-11 22:40
Niklas L9-Mar-11 22:40 
GeneralRe: memory mapped Pin
sarfaraznawaz9-Mar-11 23:57
sarfaraznawaz9-Mar-11 23:57 
GeneralRe: memory mapped Pin
Alexander M.,10-Mar-11 6:29
Alexander M.,10-Mar-11 6:29 
AnswerRe: memory mapped Pin
Niklas L10-Mar-11 20:48
Niklas L10-Mar-11 20:48 
GeneralRe: memory mapped Pin
sarfaraznawaz11-Mar-11 3:53
sarfaraznawaz11-Mar-11 3:53 
thanks

1)i tried but not able to understand what actually memory mapped file will do ....
2)i also studied in MSDN about this but i not understood the virtual address space ...
3)how it will access the data ......
please clear the above points.........




now see how i had written the code for this....
HANDLE hfile,hmapfile;
hfile = CreateFile(_T("C:\\saad.txt"),GENERIC_READ,FILE_SHARE_WRITE|FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);

if(hfile == INVALID_HANDLE_VALUE)
{
MessageBox(_T("Fail to open the drive"),_T(" "),MB_OK | MB_ICONERROR);
return -1;
}
DWORD filesize = GetFileSize(hfile,NULL);
hmapfile = CreateFileMapping(hfile,NULL,PAGE_READWRITE |PAGE_WRITECOPY |SEC_COMMIT |SEC_RESERVE,filesize,filesize,NULL);
if(hfile == INVALID_HANDLE_VALUE)
{
MessageBox(_T("Fail to open the drive"),_T(" "),MB_OK | MB_ICONERROR);
return -1;
}
DWORD pbuf = (DWORD) MapViewOfFile(hmapfile,FILE_MAP_COPY |FILE_MAP_ALL_ACCESS,0,filesize,filesize);




one more thing i want ask should i have read the file with Readfile ???
GeneralRe: memory mapped Pin
Niklas L13-Mar-11 23:35
Niklas L13-Mar-11 23:35 
GeneralRe: memory mapped Pin
sarfaraznawaz15-Mar-11 2:58
sarfaraznawaz15-Mar-11 2:58 
GeneralRe: memory mapped Pin
Niklas L15-Mar-11 3:03
Niklas L15-Mar-11 3:03 
GeneralRe: memory mapped Pin
sarfaraznawaz16-Mar-11 3:45
sarfaraznawaz16-Mar-11 3:45 
GeneralRe: memory mapped Pin
Niklas L16-Mar-11 4:10
Niklas L16-Mar-11 4:10 
GeneralRe: memory mapped Pin
sarfaraznawaz20-Mar-11 21:12
sarfaraznawaz20-Mar-11 21:12 
GeneralRe: memory mapped Pin
Niklas L20-Mar-11 23:12
Niklas L20-Mar-11 23:12 
GeneralRe: memory mapped Pin
sarfaraznawaz21-Mar-11 0:06
sarfaraznawaz21-Mar-11 0:06 
AnswerRe: memory mapped Pin
Niklas L21-Mar-11 2:06
Niklas L21-Mar-11 2:06 
QuestionHelp Microsoft Scripting Runtime Pin
goldenrose97-Mar-11 1:30
goldenrose97-Mar-11 1:30 
AnswerRe: Help Microsoft Scripting Runtime Pin
KingsGambit7-Mar-11 17:12
KingsGambit7-Mar-11 17:12 
Questionambiguous call to overloaded function.. but, it's not overloaded or ambiguous Pin
tukbriz7-Mar-11 0:49
tukbriz7-Mar-11 0:49 
AnswerRe: ambiguous call to overloaded function.. but, it's not overloaded or ambiguous Pin
Niklas L7-Mar-11 1:15
Niklas L7-Mar-11 1:15 
GeneralRe: ambiguous call to overloaded function.. but, it's not overloaded or ambiguous Pin
tukbriz8-Mar-11 3:13
tukbriz8-Mar-11 3:13 
AnswerRe: ambiguous call to overloaded function.. but, it's not overloaded or ambiguous Pin
Cool_Dev7-Mar-11 1:30
Cool_Dev7-Mar-11 1:30 
Questionchange highlight color of ClistCtrl when it not in focus Pin
xanagan6666-Mar-11 23:34
xanagan6666-Mar-11 23:34 
AnswerRe: change highlight color of ClistCtrl when it not in focus Pin
Roger Broomfield7-Mar-11 0:35
Roger Broomfield7-Mar-11 0:35 

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.