title: How to create file inside a directory using C
body: <p>I am trying to create a directory and a file inside the directory. Below is my code in C, but when I try to compile it, I got this error: <code>invalid operands to binary / (have ‘const char *’ and ‘char *’)</code></p>
  
  <pre><code>char *directory = "my_dir";
  
  struct stat dir = {0};
  if(stat(directory, &amp;dir) == -1)
  {
      mkdir(directory, 0755);
      printf("created directory testdir successfully! \n");
  }
  
  int filedescriptor = open(directory/"my_log.txt", O_RDWR | O_APPEND | O_CREAT);
  if (filedescriptor &lt; 0)
  {
      perror("Error creating my_log file\n");
      exit(-1);
  }
  </code></pre>
  
  <p>thanks for help</p>