title: Writing Integers to stream
body: <p>I have created a library which has a portion of code similar to following</p>
  
  <pre><code>int a;
  a = 5;
  
  std::ofstream outFile("File.txt");
  outFile &lt;&lt; "Values : " &lt;&lt; std::endl;
  outFile &lt;&lt; a &lt;&lt; std::endl;
  </code></pre>
  
  <p>Now, this library is used by two different process which outputs <code>File.txt</code> with two different outputs</p>
  
  <p>Output 1 :</p>
  
  <pre><code>Values :
  </code></pre>
  
  <p>Ouptut 2 :</p>
  
  <pre><code>Values :
  5
  </code></pre>
  
  <p>I've found some resources where its mentioned to pass integers to streams by converting to strings using <code>std::to_string</code> (<a href="https://stackoverflow.com/questions/37838859/converting-integer-to-string-in-c">Converting integer to string in c++</a>) . But I want to know what makes the two processes act differently in the same scenario. It feels like as if one of the process do some changes to the streams in a global state </p>