Skip to content

Instantly share code, notes, and snippets.

@jcdavis
Created December 17, 2011 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcdavis/1491758 to your computer and use it in GitHub Desktop.
Save jcdavis/1491758 to your computer and use it in GitHub Desktop.
Remove the unicodes
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char** argv) {
char buffer[4096];
FILE* inf = fopen(argv[1], "r");
FILE* outf = fopen(argv[2], "w");
while(fgets(buffer ,4096, inf)) {
char* c = buffer;
while(*c != '\n' && (unsigned char)*c >= 0x20
&& (unsigned char)*c <= 0x7F) {
c++;
}
if(*c == '\n')
fputs(buffer,outf);
}
fclose(inf);
fclose(outf);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment