title: Return FILE pointer from function and work on it on main
body: <p>I've tried to return a <code>FILE</code> pointer from some function to <code>main()</code>.
  After it, I've tried to do some <code>fprintf</code> on the pointer but it wasn't working.
  Here is my code:</p>
  
  <p>My function:</p>
  
  <pre><code>FILE *create_file(void){
  
      FILE *regularTxt = NULL;
      regularTxt = fopen("MyLogExamplekkggggggk.txt", "wt");
      if (!regularTxt){
          printf("error with regtxt");
          getchar();
          return 1;
      }
      char first_part_string[] = "kkkkik";
      fprintf(regularTxt, "%s\n\n\n%s", "ttttg", "lklf");
      return regularTxt;
  }
  </code></pre>
  
  <p>The <code>main</code> function:</p>
  
  <pre><code>int main(void)
  {
      p_txt = create_file();
      fprintf(p_txt, "%s\n\n\n%s", "gggg", "lklf");
      return 0;
  }
  </code></pre>
  
  <p>The error:</p>
  
  <blockquote>
    <p>Error 92  error C4703: potentially uninitialized local pointer variable 'p_txt' used</p>
  </blockquote>