| 
            
            
             
              【程序1】 #include "stdafx.h" #include <Windows.h> #include <stdio.h>
  void wait(char *str) {     char ch;     do     {         while (*str != '\0')             putchar(*str++);         ch = getchar();         fflush(stdin);     } while (ch != 'y'); }
  int _tmain(int argc, _TCHAR* argv[]) {     HANDLE hMap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 100, TEXT("Hello World"));     LPSTR lpStr = (LPSTR)MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, 100);     puts("请输入一段文字: ");     gets_s(lpStr, 100);
      wait("请输入y显示内存内容: ");     puts(lpStr);
      wait("请输入y关闭映射: ");     UnmapViewOfFile(lpStr);     CloseHandle(hMap);     return 0; }              
                       |