Brand new world!
This is a project that aim to visualize any kind of file by seeing how frequent are association of two characters in a file. This idea comes from conti & corte (I have to find the source then I'll put it in the readme...)
This commit is contained in:
33
fisualizer.c
Normal file
33
fisualizer.c
Normal file
@ -0,0 +1,33 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
FILE *fd;
|
||||
size_t file_sz;
|
||||
char* file_cnt;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
while(argc--){
|
||||
|
||||
const char* filename = *argv++;
|
||||
fd = fopen(filename, "r");
|
||||
if(fd == NULL){
|
||||
fprintf(stderr, "couldn't open this file: %s\n", filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
// get file size
|
||||
fseek(fd, 0, SEEK_END);
|
||||
file_sz = ftell(fd);
|
||||
rewind(fd);
|
||||
|
||||
file_cnt = malloc(sizeof(char)*file_sz);
|
||||
fread(file_cnt, sizeof(char), file_sz, fd);
|
||||
|
||||
printf("%s\n", file_cnt);
|
||||
|
||||
free(file_cnt);
|
||||
fclose(fd);
|
||||
}
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user