#include <stdio.h> int main(int argc, char** argv) { char array[256]; FILE* read_f = fopen(argv[1], "r"); if(read_f == NULL){ printf("Failed to open the file\n"); return -1; } int b = 1; // int iter = 0; while (b > 0) { //printf("\nIteration %d\n",iter); // iter++; b = fread(array, sizeof(char), 255, read_f); array[ 255 ] = '\0'; // Bug: should be b instead of 255 printf("%s",array); } fclose(read_f); }