title: Difference between opening a file in binary vs text
body: <p>I've done some stuff like:</p>
  
  <pre><code>FILE* a = fopen("a.txt", "w");
  const char* data = "abc123";
  fwrite(data, 6, 1, a);
  fclose(a);
  </code></pre>
  
  <p>and then in the generated text file, it says "abc123" just like expected. But then I do:</p>
  
  <pre><code>//this time it is "wb" not just "w"
  FILE* a = fopen("a.txt", "wb");
  const char* data = "abc123";
  fwrite(data, 6, 1, a);
  fclose(a);
  </code></pre>
  
  <p>and get the exact same result. If I read the file using binary or normal mode, it also gives me the same result. So my question is, what is the difference between fopening with or without binary mode.</p>
  
  <p>Where I read about fopen modes: <a href="http://www.cplusplus.com/reference/cstdio/fopen/" rel="noreferrer">http://www.cplusplus.com/reference/cstdio/fopen/</a></p>