fisualizer/fisualizer.c
Anthony Debucquoy 63332c6221
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...)
2023-10-19 22:57:01 +02:00

34 lines
549 B
C

#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;
}