UP | HOME

HW7
COP-3402

  1. How can we determine whether two paths refer to the same file?
  2. What flag to open will create a file if it doesn't exist already? (See lecture notes and/or man 2 open)
  3. What happens if we try to open a file that does not exist?
  4. What flag truncates a file upon opening?
  5. What happens if we open a file that already existing for writing, without truncating it, and then write bytes to it?
  6. Write a syscall that opens a file called "hello" for writing, creating it if it doesn't exist, but truncating if it doesn't. Remember to include error checking that exits with EXIT_FAILURE if the open fails.

Author: Paul Gazzillo

Created: 2025-02-03 Mon 10:30

Validate