title: why is freopen() not working on Microsoft Visual Studio but working on CodeBlocks?
body: <p>I started C++ not so long and searched so hard for different ways to read and write from/to files with no result until i tried it out on CodeBlocks which worked.. Images are attached below to point out possible errors in code though the same code were used on both applications.</p>
  
  <p><strong>Error Code:</strong> <code>Severity   Code    Description Project File    Line    Suppression State   Suppression State
  Error   C4996   'freopen': This function or variable may be unsafe. Consider using freopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. Codeforces  C:\Users\owamoyo\source\repos\Codeforces\Codeforces.cpp 6</code>      </p>
  
  <p><a href="https://i.stack.imgur.com/QzWcS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QzWcS.jpg" alt="Code Blocks"></a></p>
  
  <pre><code>#include&lt;bits/stdc++.h&gt;
  
  using namespace std;
  
  int main() {
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
      int n; cin &gt;&gt; n;
      while (n--) {
          int x; cin &gt;&gt; x;
          cout &lt;&lt; x &lt;&lt; " ";
      }
      return 0;
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/k40ph.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k40ph.jpg" alt="MS Visual Studio"></a></p>
  
  <pre><code>#include&lt;bits/stdc++.h&gt;
  
  using namespace std;
  
  int main() {
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
      int n; cin &gt;&gt; n;
      while (n--) {
          int x; cin &gt;&gt; x;
          cout &lt;&lt; x &lt;&lt; " ";
      }
      return 0;
  }
  </code></pre>