![]() |
Computer Systems Lab CS1000 |
![]() Wiscinfo |
![]() CS Home |
![]() CSL |
![]() CS1000 |
![]() Feedback |
Files must be named so that you can identify them to the system
(these names are appropriately called
filenames). Filenames can
be as long as you wish (up to about 255 characters) and can
contain many different characters, although we suggest you stick
to the standard ones: letters, digits, underscores and periods.
Some typical filenames are
main.c, prog1.C, file.o, a.out
and main.
Filenames which contain metacharacters that also have special
meaning to the shell ( ) [ ] $ | ! & ' "
? /
< and >
should be avoided.
There are several conventions for naming files. For example, you may have noticed above that the file containing the C program was named prog1.c. The C compiler expects its input from files whose names end in .c. In general, a suffix designates a source file (program text) and the absence thereof designates an executable. Here are some of the common suffixes:
.c |     | C source |
.cc or .C |     | C++ source code |
.f |     | Fortran text |
.o |     | intermediate object code (NOT human readable) |
.Z |     | compressed file (NOT human readable, use uncompress) |
.gz |     | gzipped file (NOT human readalbe, use gunzip) |
.tar |     | tarred file (usually NOT human readable, use tar -xvf) |