out: Friday, April 18, 2025
due: Monday, April 21, 2025 by 10:00 am,
No late exercises accepted.
Goals: Learn to use POSIX I/O routines to scan a file directory and read the contents of selected files. These routines will be needed in later parts of the large project sequence. This exercise provides a chance to learn how to use them in a much simpler setting without additional complications of the larger project.
Description: Write a C program that:
.txt
. You should not scan
subdirectories, and you do not need to sort
the directory entries; you may also assume that no subdirectory
itself has a directory name ending in .txt
.open
/ read
/ close
functions,
copying the contents to stdout
. You may use C standard library
functions (hint: fwrite
) to write to stdout
, but you must use
open
/ read
/ close
to read the files.stdout
.
Copy the bytes from the input file(s) exactly as they are with
no changes.
Your code must:
valgrind
)ex7.c
that compiles with the command gcc -Wall -g -std=c17 -o ex7 ex7.c
-- do
not submit a Makefile.cpplint --clint
.
read
.
You should submit your exercise using the Gradescope dropbox linked on the course resources web page.