title: fscanf c programming wierd error
body: <p>I am not new to programming, but I encountered this small problem and I can't seem to get it.
  I want to read a file with dates and put them in another file with another format</p>
  
  <p><strong>Input example</strong>: 18.08.2015<br>
  <strong>Output example</strong>: 18-08-2015 </p>
  
  <p>Here is the code (dat1 has "r" permission and dat2 "w"):</p>
  
  <pre><code>char d[3];
  char m[3];
  char g[5];
  while(fscanf(dat1,"%s.%s.%s\n",&amp;d,&amp;m,&amp;g)==3)
  {
      fprintf(dat2,"%s-%s-%s\n",d,m,g);
  }
  </code></pre>
  
  <p>On the other hand, this works fine if I use [space] instead of a [dot] in the input file. 
  (18 08 2015)</p>
  
  <p>What am I missing? The solution has to be as simple as possible and with using fscanf, not fgetc or fgets, to be explained to students that are just beginning to learn C. Thanks.</p>