Skip to content

Instantly share code, notes, and snippets.

@colematt
Last active February 23, 2024 18:42
Show Gist options
  • Save colematt/f2b9ec89612f291f5fdca473b4cd195d to your computer and use it in GitHub Desktop.
Save colematt/f2b9ec89612f291f5fdca473b4cd195d to your computer and use it in GitHub Desktop.
[Print Control Characters] #c
#include <locale.h>
#include <stdio.h>
#include <wchar.h>
/* REFERENCES
* Control Block: http://unicode.org/charts/PDF/U0000.pdf
* Control Pictures: http://unicode.org/charts/PDF/U2400.pdf
*/
int main(int argc, char* argv[]) {
setlocale(LC_CTYPE, "");
// Print a single unicode character
wchar_t star = 0x2605;
wprintf(L"%lc\n", star);
// Print a block of unicode characters
// corresponding to the ASCII ctrl chars
for (wchar_t w = 0; w <= 0xA; w++) {
wprintf(L"%lc ", w + 0x2400);
}
printf("\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment