title: Why does reading a file that doesn't exist print garbage characters?
body: <p>I try to understand the file reading in <code>c++</code> and try to read a file that doesn't exist deliberately</p>
  
  <pre><code>//includes ommited
  
  int main(int argc, char ** argv)
  {
          if(argc != 1)
                  throw std::exception();
          std::ifstream file(argv[0]);
          std::string content((std::istream_iterator&lt;char&gt;(file)), std::istream_iterator&lt;char&gt;());
          std::cout &lt;&lt; content.c_str() &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p><strong><a href="http://coliru.stacked-crooked.com/a/9e0f5c0e090045f9" rel="nofollow">DEMO</a></strong></p>
  
  <p>It prints the following:</p>
  
  <pre><code>ELF
  </code></pre>
  
  <p>Why is it supposed to mean? Do I just get UB by doing this? Since I'm a Java coder I expected that some exception will be thrown if we try to read a file that doesn't exist...</p>