C Review Exercises and Linking / Unlinking

Background info:

Link command:

gdb Debug commands: http://condor.depaul.edu/glancast/373class/docs/gdb.html

Exercise #1: Exploring programming with links:

Write a program that creates a file, links it 2 other names, writes to the original file and unlinks the original file.

Create a file named link1.txt

Link the file to link2.txt

Link the file to link3.txt

Write hello to the file link1.txt

Unlink link1.txt

Exercise #2: debugging directory read program.

wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/gdbexercise/readdirectory.c

inside the directory you retrieved the program to, create a directory and put in 2 files and one directory

mkdir testdir
cp readdirectory.c testdir/x.c
cp readdirectory.c testdir/y.c
mkdir testdir/insidedir

read the comments inside readdirectory.c and follow the instructions to debug to see the problem, then fix it.

You need to debug even if you can see the problem without debugging.

Exercise #3: debugging timestampwithseek program.

wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/gdbexercise/timestampwithseek.c

wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/gdbexercise/testtime.txt

read the comments inside timestampwithseek.c and follow the instructions to debug to see the problem, then fix it.

You need to debug even if you can see the problem without debugging.

Exercise #4: debugging alarm.c

wget http://home.adelphi.edu/~pe16132/csc271/note/scripts/fileio/gdbexercise/alarm.c

read the comments inside alarm.c and follow the instructions to debug to see the problem, then fix it.

You need to debug even if you can see the problem without debugging.