Can't write a binary file
<p>I have the following piece of code in C++.</p>

<pre><code>int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
ofstream output("Sample.txt", ios::out | ios::binary);

for(int i = 0; i &lt; 10; i++)
{
  output&lt;&lt;arr[i];
}
</code></pre>

<p>Now the Sample.txt is like this:</p>

<pre><code>12345678910
</code></pre>

<p>Isn't the "Sample.txt" supposed to be in binary? Why doesn't it convert everything into binary when i opened the stream in binary mode. What should I do, incase i need binary of every element in the array and then print it to the file.</p>
