string - Saving struct to clipboard in C++ -
i have structure in c++ code: struct sdata { dword number; int currentnumber; bool gameover; }; i need save clipboard structure 1 process. , other process need load again structure . can easy cstrings/strings not structures . suggest me? this method setting cstring clipboard: bool settext(cstring text) { cstring source; source = text; //put text in source if (openclipboard(null)) { hglobal clipbuffer; char * buffer; emptyclipboard(); clipbuffer = globalalloc(gmem_ddeshare, source.getlength() + 1); buffer = (char*)globallock(clipbuffer); strcpy(buffer, lpcstr(source)); globalunlock(clipbuffer); setclipboarddata(cf_text, clipbuffer); closeclipboard(); return true; } else { return false; } } and getter: std::string gettext(void) const { ...