Created
June 22, 2019 14:46
-
-
Save pythongo1/c7e0465aad9cb9feb98949c42ede1d25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <windows.h> | |
#include <stdio.h> | |
#include <conio.h> | |
#include <tchar.h> | |
#pragma comment(lib, "user32.lib") | |
int main() | |
{ | |
HANDLE hMapFile; | |
LPCTSTR pBuf; | |
hMapFile = OpenFileMapping( | |
FILE_MAP_ALL_ACCESS, // read/write access | |
FALSE, // do not inherit the name | |
TEXT("SharedObject")); // name of mapping object | |
if (hMapFile == NULL) | |
{ | |
printf(TEXT("Could not open file mapping object (%d).\n"), GetLastError()); | |
return 1; | |
} | |
pBuf = (LPTSTR) MapViewOfFile(hMapFile, // handle to map object | |
FILE_MAP_ALL_ACCESS, // read/write permission | |
0, | |
0, | |
0); | |
if (pBuf == NULL) | |
{ | |
printf(TEXT("Could not map view of file (%d).\n"), GetLastError()); | |
CloseHandle(hMapFile); | |
return 1; | |
} | |
printf("the catalan number is \n%s",pBuf); | |
UnmapViewOfFile(pBuf); | |
CloseHandle(hMapFile); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment