My program is supposed to take input via the console and use shared memory so that another process can get access to the input. Apparently CopyMemory is causing a segmentation fault.

    std::string Input;
    std::cout << "What Text do you want to encrypt? ";
    std::getline(std::cin, Input);   

    //create named shared memory
    HANDLE shmMapFile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, 
                                            PAGE_READWRITE, 0, 256, _T("shared_mem"));

    //view the mapped memory (makes adress space visible)
    LPCTSTR shmBuffer = (LPTSTR)MapViewOfFile(shmMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 256);

    //Copy Input into shared memory. c_str converts string to pointer to char array
    CopyMemory(shmMapFile, Input.std::string::c_str(), 256);

我想它与指针有关,但是我找不到错误的原因。 那我哪里出问题了?还是我使用的功能不正确?