CMPSC 311 – File Input/Output & Systems Programming

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/44

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards covering key terms, functions, flags, and concepts from the CMPSC 311 lecture on file input/output and system programming.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

45 Terms

1
New cards

Input/Output (I/O)

The process of moving bytes into or out of devices, files, networks, etc.

2
New cards

Buffered I/O

I/O in which the system temporarily stores extra data in memory, reducing device accesses and system calls.

3
New cards

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.

4
New cards

Blocking I/O

I/O in which a call waits until the read or write completes before returning.

5
New cards

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.

6
New cards

Asynchronous I/O

I/O issued through a separate API that returns immediately and later triggers a callback when the operation completes.

7
New cards

Short read/write

A read or write that completes with fewer bytes than requested when using non-blocking I/O.

8
New cards

STDIN

The default standard input stream for a program (file descriptor 0).

9
New cards

STDOUT

The default standard output stream for a program (file descriptor 1).

10
New cards

STDERR

The default standard error stream for a program (file descriptor 2).

11
New cards

I/O Redirection

Shell feature that routes program input/output to or from files using operators like < and >.

12
New cards

Pipe (|)

Shell construct that sends the STDOUT of one program directly to the STDIN of another.

13
New cards

libc

The C standard library providing core functionality such as stdio, memory, math, and system-interface wrappers.

14
New cards

Library call

A function provided by a language’s standard library, e.g., fopen(); executes in user space.

15
New cards

System call

A kernel-mediated function invoked via the OS, e.g., open(); enters kernel mode.

16
New cards

FILE structure (FILE*)

An opaque C library object that maintains state for buffered, high-level file I/O.

17
New cards

Stream

Another name for a FILE* object representing a sequence of bytes for input or output.

18
New cards

fopen()

C library call that opens a file and returns a FILE* stream pointer.

19
New cards

fopen mode "r"

Opens existing text file for reading, stream positioned at start.

20
New cards

fopen mode "w"

Creates or truncates a text file for writing, stream positioned at start.

21
New cards

fopen mode "a"

Opens (or creates) a file for appending; writes occur at end of file.

22
New cards

fscanf()

Formatted input function that reads data from a FILE* according to a format string.

23
New cards

fgets()

Reads a line (or up to size-1 chars) from a FILE* into a buffer, stopping at newline or EOF.

24
New cards

fprintf()

Formatted output function that writes data to a FILE* using printf-style formatting.

25
New cards

fputs()

Writes a null-terminated string to a FILE* without additional formatting.

26
New cards

fflush()

Forces any buffered write data to be sent to the OS or discards buffered read data.

27
New cards

fclose()

Closes a FILE* stream and frees associated resources (also flushes buffers).

28
New cards

open()

System call that opens/creates a file and returns an integer file descriptor.

29
New cards

O_RDONLY

open() flag specifying read-only access.

30
New cards

O_WRONLY

open() flag specifying write-only access.

31
New cards

O_RDWR

open() flag specifying both read and write access.

32
New cards

O_CREAT

open() option that creates the file if it does not exist.

33
New cards

O_EXCL

open() option that requires O_CREAT and fails if the file already exists.

34
New cards

O_TRUNC

open() option that truncates an existing file to zero length.

35
New cards

File descriptor

A non-negative integer index into a per-process kernel table identifying an open file or device.

36
New cards

read()

System call that copies up to count bytes from a file descriptor into a buffer and returns the bytes read.

37
New cards

write()

System call that copies count bytes from a buffer to a file descriptor and returns the bytes written.

38
New cards

close()

System call that releases a file descriptor and its table entry.

39
New cards

Discretionary Access Control

UNIX model where file owners set read, write, and execute permissions for user, group, and world.

40
New cards

UNIX permission bits (rwx)

Three-bit groups indicating read (r), write (w), and execute (x) rights for owner, group, and others.

41
New cards

S_IRUSR

Permission constant (00400) giving file owner read access when used in mode arguments.

42
New cards

Absolute path

File path starting from the filesystem root '/', e.g., /home/user/file.txt.

43
New cards

Relative path

File path specified relative to the current working directory, e.g., ./docs/report.txt.

44
New cards

stdio.h

C header that declares standard I/O functions like printf(), scanf(), fopen(), etc.

45
New cards

unistd.h

POSIX header declaring system calls such as read(), write(), close(), and many others.