title: C File handling in visual studio 2017
body: <p>The file handling commands in Visual Studio seem to be different than normal. I'm currently learning the very basics of File Handling in C, but the commands don't seem to be working. This is what I've got right now -</p>
  <pre><code> #include &lt;stdio.h&gt;
   int main()
  {
     int num;
     FILE *fptr;
     fptr = fopen(&quot;C:\\&quot;, &quot;program.txt&quot;, &quot;w&quot;);
  
     if (fptr == NULL)
    {
        printf(&quot;Error!&quot;);
        exit(1);
    }
  
      printf(&quot;Enter num: &quot;);
      scanf_s(&quot;%d&quot;, &amp;num);
  
      fprintf(fptr, &quot;%d&quot;, num);
      fclose(fptr);
  
       return 0;
  }
  </code></pre>
  <p>Here's the build output-</p>
  <blockquote>
  <p>'fopen': too many actual parameters</p>
  <p>warning C4013: 'exit' undefined; assuming extern returning int</p>
  <p>error C4996: 'fopen': This function or variable may be unsafe. Consider using</p>
  <p>fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.</p>
  </blockquote>
  <p>When I use fopen_s instead, like this fopen_s(&quot;C:\program.txt&quot;, &quot;w&quot;), it says-</p>
  <blockquote>
  <p>'function': 'FILE **' differs in levels of indirection from 'char [15]'</p>
  <p>'fopen_s': different types for formal and actual parameter 1</p>
  <p>'fopen_s': too few arguments for call</p>
  <p>'=': 'FILE *' differs in levels of indirection from 'errno_t'</p>
  </blockquote>
  <p>I need some serious help.</p>