The Cygwin (http://www.cygwin.com/) package provides a Unix-on-Windows compatibility package. This lets you use the Unix commands we saw in class. You enter your commands into a Cygwin window, just like we do in class.
Installation of Cygwin is not difficult. Start by going to
http://www.cygwin.com/ and clicking on the "Install Cygwin now" link
(marked with the
).
This will download a setup.exe program; if you are using
Windows 98, Internet Explorer may suggest saving the file into "My
Download Files". This default is fine, or you may choose another
folder. Please do not download it to your desktop! Press the "Save"
button, and wait for the program to download.
Once setup.exe has finished downloading, open it. Then follow these
easy steps:
C:/cygwin, which is fine. The default
text file type can be "Unix", and the "Install For" can be
"All". The click "Next".>C:\My Download Files), unless you know what
you are doing and another location seems more reasonable to you
for your system. Then click "Next".xemacs, click on the category "Editors".
Then find the package "xemacs" and "xemacs-sumo". Click on the
entry under "New" until a version number appears. Note: There
is a similar editor called emacs. I recommend that you do not
install emacs.On Windows, you can enter operating system commands using a "DOS
Shell" window. On Unix or Linux systems, one enters operating system
commands in a "terminal emulator" window. Cygwin gives you something
in between. It allows you to enter Unix commands, as well as some
Windows commands, on a Windows system. Most important for our course:
Cygwin provides the gcc command for compiling programs.
If you choose, you can use notepad instead of xemacs to edit your
programs. For instance, if you want to edit hw.c with notepad, you
would enter the command:
notepad hw.c &
The first time, it may tell you that hw.c does not exist, do you want
to create it? Of course you do...
You can compile your programs using the gcc commands:
gcc -ansi -pedantic -Wall hw.c
The programs it creates is called a.exe. To run this, you must type:
./a.exe
To print your program, you can use notepad's print option. Cygwin
does not provide the script command, found on other Unix systems, so
there is no easy way I know of to capture the output of running a C
program. You may want to submit your program as an email attachment.
Beginning C Programming for Engineers