title: Check if file exists - C programming
body: <p>I've had trouble trying to create this function that takes users input and checks if the file exists or not. I keep on getting warning messages (format specifies type 'char *' but the argument has type 'const char **') every time I try to run the code.</p>
  <p>I've tried to declare the variable fileName in different ways but it still seems to not be working. So I'm curious to know if I'm using access wrong or if it's even possible to use when taking user input.</p>
  <pre><code>int readFunc(const char *fileName) {
      printf(&quot;Search for file: &quot;);
      scanf(&quot;%s&quot;, &amp;fileName);
  
      if(access(fileName, F_OK) == 0) {
          menuFunc();
      } else {
          printf(&quot;File doesn't exist!\n&quot;);
      }
  }
  </code></pre>