Quick question: in this example code:
printf ("\nType in 1st address: ");
scanf ("%x", &address1);
address1 = (address1 - number1) * 2;
printf ("\nResult = %08X\n\n", address1);
How can I copy the contents of var address1 onto the clipboard?
Quick question: in this example code:
printf ("\nType in 1st address: ");
scanf ("%x", &address1);
address1 = (address1 - number1) * 2;
printf ("\nResult = %08X\n\n", address1);
How can I copy the contents of var address1 onto the clipboard?
For the future readers, I decided to show an example how to do this - in Windows.
First format the data by using sprintf (http://www.tutorialspoint.com/c_standard_library/c_function_sprintf.htm) if it's not already in correct format(const char*).
Then use the following Windows API to set the clipboard data.
Here is a very basic example usage of those API's without any return/error value checking.
const char *Str = "Hello world";
const size_t strLen = lstrlenA(Str) + 1;
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, strLen); //Memory must be moveable!
memcpy(GlobalLock(hGlobal), Str, strLen);
GlobalUnlock(hGlobal);
OpenClipboard(NULL);
EmptyClipboard();
SetClipboardData(CF_TEXT, hGlobal);
CloseClipboard();