1/44
Vocabulary flashcards covering key terms, functions, flags, and concepts from the CMPSC 311 lecture on file input/output and system programming.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Input/Output (I/O)
The process of moving bytes into or out of devices, files, networks, etc.
Buffered I/O
I/O in which the system temporarily stores extra data in memory, reducing device accesses and system calls.
Unbuffered I/O
I/O performed directly between user buffers and the device, e.g., read() and write(), without extra caching by the C library.
Blocking I/O
I/O in which a call waits until the read or write completes before returning.
Non-blocking I/O
I/O in which the call returns immediately even if the operation has not completed, possibly resulting in short reads/writes.
Asynchronous I/O
I/O issued through a separate API that returns immediately and later triggers a callback when the operation completes.
Short read/write
A read or write that completes with fewer bytes than requested when using non-blocking I/O.
STDIN
The default standard input stream for a program (file descriptor 0).
STDOUT
The default standard output stream for a program (file descriptor 1).
STDERR
The default standard error stream for a program (file descriptor 2).
I/O Redirection
Shell feature that routes program input/output to or from files using operators like < and >.
Pipe (|)
Shell construct that sends the STDOUT of one program directly to the STDIN of another.
libc
The C standard library providing core functionality such as stdio, memory, math, and system-interface wrappers.
Library call
A function provided by a language’s standard library, e.g., fopen(); executes in user space.
System call
A kernel-mediated function invoked via the OS, e.g., open(); enters kernel mode.
FILE structure (FILE*)
An opaque C library object that maintains state for buffered, high-level file I/O.
Stream
Another name for a FILE* object representing a sequence of bytes for input or output.
fopen()
C library call that opens a file and returns a FILE* stream pointer.
fopen mode "r"
Opens existing text file for reading, stream positioned at start.
fopen mode "w"
Creates or truncates a text file for writing, stream positioned at start.
fopen mode "a"
Opens (or creates) a file for appending; writes occur at end of file.
fscanf()
Formatted input function that reads data from a FILE* according to a format string.
fgets()
Reads a line (or up to size-1 chars) from a FILE* into a buffer, stopping at newline or EOF.
fprintf()
Formatted output function that writes data to a FILE* using printf-style formatting.
fputs()
Writes a null-terminated string to a FILE* without additional formatting.
fflush()
Forces any buffered write data to be sent to the OS or discards buffered read data.
fclose()
Closes a FILE* stream and frees associated resources (also flushes buffers).
open()
System call that opens/creates a file and returns an integer file descriptor.
O_RDONLY
open() flag specifying read-only access.
O_WRONLY
open() flag specifying write-only access.
O_RDWR
open() flag specifying both read and write access.
O_CREAT
open() option that creates the file if it does not exist.
O_EXCL
open() option that requires O_CREAT and fails if the file already exists.
O_TRUNC
open() option that truncates an existing file to zero length.
File descriptor
A non-negative integer index into a per-process kernel table identifying an open file or device.
read()
System call that copies up to count bytes from a file descriptor into a buffer and returns the bytes read.
write()
System call that copies count bytes from a buffer to a file descriptor and returns the bytes written.
close()
System call that releases a file descriptor and its table entry.
Discretionary Access Control
UNIX model where file owners set read, write, and execute permissions for user, group, and world.
UNIX permission bits (rwx)
Three-bit groups indicating read (r), write (w), and execute (x) rights for owner, group, and others.
S_IRUSR
Permission constant (00400) giving file owner read access when used in mode arguments.
Absolute path
File path starting from the filesystem root '/', e.g., /home/user/file.txt.
Relative path
File path specified relative to the current working directory, e.g., ./docs/report.txt.
stdio.h
C header that declares standard I/O functions like printf(), scanf(), fopen(), etc.
unistd.h
POSIX header declaring system calls such as read(), write(), close(), and many others.