title: Multiple (randomly chosen) outputs across different launches of the same program. Random characters added when fscanf'ing
body: <p>Simple program: reads a name and a surname (John Smith) from a .txt file via fscanf, adds spaces, prints the name in the console (just as it's written in the .txt).</p>
  
  <p>If compiled and ran on Win10 via </p>
  
  <blockquote>
    <p>Microsoft (R) C/C++ Optimizing Compiler Version 19.14.26433 for x86</p>
  </blockquote>
  
  <p>the following code does not produce the same output for the same input across different .exe launches (no recompiling). For each input it seems to have multiple outputs avaialble, between which the program decides at random.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int main() 
  {
      char input_file_name[255];
      FILE * input_file;
      char name[255];
      input_file = fopen ("a.txt","r");
      do
      {       
          if (strlen(name) != 0 )
              name[strlen(name)] = ' ';
  
          fscanf (input_file, "%s", name + strlen(name) * sizeof(char));
      }while(!feof(input_file));
      fclose (input_file);
      printf("Name:%s\n", name);
      system("pause");
      return 0;
  }
  </code></pre>
  
  <p>I will list a couple of inputs and outputs for them. As not all characters are printable, I will type type them as \ascii_code instead, such as \97 = a.
  The most common anomalies are \31 (Unit Separator) added at the very front of the string and \12 (NP form feed, new page) or \17 (device control 1) right before the surname (after the first space).</p>
  
  <ol>
  <li><p>For "John Smith":</p>
  
  <ul>
  <li>"John Smith" (proper output)</li>
  <li>"\31 John Smith"</li>
  </ul></li>
  <li><p>For "Atoroco Coco"</p>
  
  <ul>
  <li>"Atoroco \12Coco"</li>
  <li>"\31 Atoroco \16Coco"</li>
  </ul></li>
  <li><p>For "Mickey Mouse"</p>
  
  <ul>
  <li>"Mickey Mouse" (proper)</li>
  <li>"\31 Mickey\81Mouse" (There is a \32 (space) in the string right before the \81, but the console doesn't show the space?!)</li>
  </ul></li>
  </ol>
  
  <p>If compiled a different machine (MacOS, compiler unknown) it seems to work properly each time, that is it prints simply the .txt's contents.</p>
  
  <p>Why are there multiple outputs produced, seemingly at random?
  Why are these characters (\31, \12 etc) in particular added, and no other?</p>