DemoLinux is on the CD given to you in class. This will allow you
to use Linux at home and do your projects without having to install
Linux on your computer. This has certain advantages to students who
do not know if they want to get involved with computers in a big
way, but still have some of the advantages of having Linux installed.
When you are doing some of the steps below, it can be a little
slow (slower than if Linux was installed, because it is tied to
the speed of your CDROM player. Normally, each step should be
finished in about a minute.
To use DemoLinux, put the CD into the CD player and reboot your
computer. (If you are not fast enough, a web page will appear on
your screen with the word "Welcome" in six languages. Just reboot.)
When the screen comes up, there are some instructions. Because
this depends on exactly how your computer is fixed up, this
instructions might have to be modified to work correctly.
There is an additional step if your computer can not boot directly
from the CD. You have to make a boot floppy.
Put the CD into the computer while still using Windows. Change
directory to the CDROM (whatever letter it is on your system).
From there go into the directory dosutils. You have to execute
the program rawrite.exe. When the prompt asks for
Enter disk image source file name:
(Assuming your CDROM is drive D:, answer:
It will then prompt you:
Enter target diskette drive
For most of you, it will be A: Then it will prompt you
Please insert a formatted diskette into drive A: and press -ENTER- :
Put in a DOS formatted floppy and press the ENTER key.
When it is finished, you have the diskette in its drive and the CD in
its drive and reboot (restart) your computer. Follow the instructions
for "From CD".
When "boot:" appears, I just hit the <Enter> key and let it
do its thing. If it asks questions about printers or networks,
just hit the <Enter>. There are too many possibilities for
me to cover everything.
When it asks for "language", select "English". When it asks for
keyboard, again select "English". (I did this one time and every
thing came up in Spanish. Just reboot and try again.)
When you get to the login screen, there is a picture of a penguin
with the word "demo" underneath it. Double-click on the penguin.
The instructions on the screen mention a "Enter" button, but click
on the "Go!" button. I am not sure which window managers are possible
but I take "default". But I like KDE, which is what I get.
(It also came up in KDE when I asked for fail-safe.)
On the toolbar at the bottom, there will be an icon that looks
like a monitor (or a terminal) with a shell on it. Click on that
to start a window. Then type:
xemacs proj0.c &
xemacs is a graphical editor, very similar in concept to something
like WordPad under Microsoft Windows that you should be able
to figure out with no special pains. The window will have the title
of "emacs". I prefer to maximize it so that it takes up the full
Type in your program and correct any mistakes that you might
have made. Remember mistakes are a part of learning. Just fix
them and keep on going. (You don't even have to tell anyone
about them, and we don't charge you for them!) Then save the
work to the disk file.
Saving the file makes it look like it is a disk file, but
it is not really. to save it to your disk, do a "Save as"
and give it the name of:
which will save it to your hard disk. To save it to a floppy,
you must give it the name of:
(You will get a message that include "Operation not permitted",
don't worry about that, the floppy is formatted for Windows
and the permissions system are different.)
Naturally, this is only good for proj0.c. When you are working
with other projects, change the name of proj0.c to whatever name
is specified in the project requirements.
You can compile inside xemacs or at a command prompt. I prefer
to stay within xemacs as much as possible.
Inside xemacs, just click on the "Compile" button. A box will
appear, and click on "Edit Command" button. The command
appears, but we need to make it:
gcc -Wall -ansi proj0.c
If you are going to use a debugger, then the command needs to be:
gcc -g -Wall -ansi proj0.c
When you are in the Terminal window, you can compile
using the same commands.
Executing the Program
You can execute the program in two different ways,
from within xemacs or at the Linux prompt in the terminal.
In xemacs, you can select "Tools", and select "Shell".
that will give you a part of the window for shell commands.
The program will execute (or crash) as normal.
In a terminal window, just use the same command.
If you are like most people, you will have problems. If it
does not compile, you need to go back to the editing phase
and locate and fix the problem. Then recompile and try again.
The compiler trys to help by telling you which line it thinks
the problem is on. Well, sometimes it does not know there
is a problem right away. Most of the time when it is wrong,
the problem in the line just before this one. It did not
know there was a problem until it tried to compile the
next line. (Off-by-One problem!) This is especially true
if you forgot a semi-colon!
Finding symantically problems is harder! Something is wrong,
but where? You will have to review you program on a line by line
basis, and do what the computer is doing. Sometimes that will
help. Other times, we can use print statements to see what the
variable is getting set to.
There is also a debugger that will let us step through
the program one statement at a time. I will get another web
page for the debugger.