Courses/Computer Science/CPSC 457.W2012/Lecture Notes/FileIO

Jump to: navigation, search

File I/O

In this session, we will consider the user-level, C lib perspective of file input and output operations. We will contemplate the file abstraction and how it is exposed on Unix, including naming, addressing, types, utilities, and basic operations. We will also touch on file locking and file attributes.

Files. File input-ouput. Permissions. Attributes. Functions (open/read/write/close/lseek/stat). Threads, processes, and file locking.

  • file permissions and attributes.
  • the difference between FILE and file descriptors
  • stat(1)
  • file(1) / magic numbers / types
  • operations: open, read, write, lseek, close
  • operations: fopen, fread, fwrite, fseek, fclose, EOF


Slides from today.

A summary of the command line history from today.

strace output from today.

Information showing various properties of the files and directory we manipulated today, including a demonstration of the ln command:

directory info


  • MOS: 4.1
  • MOS: 4.2