I've written a bunch of short C programs to demonstrate how C programs interface with and use the Unix operating system. Here are links to them, in approximately the order in which I'll discuss them:
ask.c
, ask_funcs.c
,
ask_funcs.h
, and Makefile
.
An example of writing C code spread over several source files.Several examples using the
fork
system call to spawn a subprocess. The whole
directory is downloadable here.
Makefile, an example of make
input for compiling a bunch of different C programs.
(Note that it uses
mycat4.c,
dump4.c,
mycat5.c,
dump5.c,
mycat6.c,
dump6.c,
mystuff.h,
mycat.c,
clongword.c,
lexlongword.l,
caesar1.l, and
caesar2.l.)