Skip to content

Instantly share code, notes, and snippets.

@petabyt
Created January 28, 2021 02:53
Show Gist options
  • Save petabyt/5aca20831c53c93c5aa6fc593c45be13 to your computer and use it in GitHub Desktop.
Save petabyt/5aca20831c53c93c5aa6fc593c45be13 to your computer and use it in GitHub Desktop.
hex.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
if (argc != 2) {
return -1;
}
FILE *reader = fopen(argv[1], "r");
int c = fgetc(reader);
while (c != EOF) {
printf("%X ", c);
c = fgetc(reader);
}
return 0;
}
@petabyt
Copy link
Author

petabyt commented Jan 28, 2021

Print itself in hex
tcc -run hex.c hex.c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment