title: How to print a fread()?
body: <p>I swear, I have researched a lot before asking here, but could not find anything that could help.</p>
  
  <p>I have a file with the extension .pcm that contains data (in numbers) that I want to use later with some operations. For now, just to see what the data is, I want only to printf its contents. It probably should be read as type short, since I have had used this same file in MatLab before.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      FILE *fp;
      short input[1000];
      int i;
      fp=fopen("Sweep_10_310.pcm", "rb"); 
      if (!fp) { 
          printf("Could not open file!\n"); 
          return 1; 
      }
  
      for (i = 0; i &lt; 100; i++)
      {
          printf("%d",fread(input,sizeof(short),1,fp));
      }
      fclose(fp);
      return 0;
  }
  </code></pre>
  
  <p>The console prints only zeroes.</p>
  
  <p>If I change the file for a different text file (just to test the code) and change all "short" to "char", I get the same result. Which is the ideal way to fread a file?</p>
  
  <p>** Edit:
  In the end, my file was actually empty :(
  Anyways, the answers here work and a lot were learned</p>