Last active
September 4, 2016 10:12
-
-
Save sykhro/b5c437ac5c6065abf4c0f8d0505baeff to your computer and use it in GitHub Desktop.
The dumbest idea ever to get code ready to be sent on Discord
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I don't have backticks on my keyboard. | |
// Instead of using the altcodes or copy-pasting them, | |
// when I need to send code on discord I simply run this | |
// It's not portable at all and it's pretty stupid | |
#include <stdio.h> | |
#include <windows.h> | |
int | |
main (int argc, char *argv[]) | |
{ | |
OpenClipboard(0); | |
HANDLE hData = GetClipboardData(CF_TEXT); | |
char * clip = (char*)GlobalLock(hData); | |
if (argc != 2) { | |
printf("usage: language"); | |
} | |
else { | |
printf("\n```%s\n", argv[1]); | |
printf("%s", clip); | |
printf("\n```\n"); | |
// Release the lock | |
GlobalUnlock(hData); | |
// Release the clipboard | |
CloseClipboard(); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment