I am working on a personal project and have encountered an obstacle. My task is simply to read a string and then copy that string to the clipboard but I am not able to get these 2 tasks merged.
To read a string:
string name;
getline (cin,name);
To copy to clipboard (Code found online -- working):
const char* output = "oooo";
const size_t len = strlen(output) + 1;
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, len);
memcpy(GlobalLock(hMem), output, len);
GlobalUnlock(hMem);
OpenClipboard(0);
EmptyClipboard();
SetClipboardData(CF_TEXT, hMem);
CloseClipboard();
However, as I am not an expert I have not been able to combine these 2 tasks. Any help is appreciated