title: binary to buffer in C
body: <p>I'm trying to fix this problem, but i dont know why it doesn't work! In my main function I'm getting the name of the binary file (argv[1])! Now I'm trying to get the content into a char Array (Buffer) to handle the content in another function. But i dont know why I get a 0 when i printf "readed" and why theres is no output when i printf the buffer!</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  //only allowed libaries
  
  
  
  int readBin (char *bin_file_name, char *txt_file_name)
  {
  
    int readed = 0;
    FILE *input = fopen(bin_file_name, "rb");
    int file_size = 0;
    char *buffer;
  
    //get Filesize 
    fseek(input, 0, SEEK_END);
    file_size = ftell(input);
    rewind(input);
  
    //Allocate memory for buffer
    buffer = (char*) malloc(sizeof(char)*file_size);
  
    //Fill Buffer
    readed = fread(buffer,file_size,0, input);
  
    printf("%i\n", readed);
    printf("%s\n", buffer);
  
    return 0;
  }
  </code></pre>
  
  <p>Thank you for your help!!!</p>