title: Can not read from opened file
body: <p>The file exists and I have just read from it in another function. The other function closes the file. Now, my <code>workwith()</code> tries to open it and read from it.</p>
  
  <p>My code:</p>
  
  <pre><code>if (access(path_file, F_OK) != -1) {
    // file exists
    *mfs_desc = open(path_file, O_WRONLY | O_RDONLY, 0600);
    if (*mfs_desc == -1) {
      perror("opening file");
      exit(1);
    }
    printf("file_descriptor = %d, filename = |%s|\n", *mfs_desc,
           path_file);
    if ((read(*mfs_desc, superblock, sizeof(Superblock))) == - 1) {
      perror("read superblock");
      exit(1);
    }
  }
  </code></pre>
  
  <p>However, I am getting this output:</p>
  
  <pre><code>file_descriptor = 3, filename = |t.mfs|
  read superblock: Bad file descriptor
  </code></pre>
  
  <p>I suspect that the way I am opening the file is not correct. I want to open the file for writing and reading purposes. The file already exists. What am I missing?</p>