C Environment Primer

Primer for using the CSIS 610 labs

1. Logging on to the system

After turning the machine on, double-click the telnet icon.

When the telnet screen comes up, open the connect menu, and choose frodo.

Enter your login name and password when prompted.

1.1. Logging out

To exit Frodo and return to the PC, type logout at the frodo prompt. Do not forget to do this before leaving the lab.

1.2. Changing your password

It is recommended that you change your password on a regular basis. To do so, use the Unix command passwd.

You will be prompted for both your old password and the new one (twice for confirmation). Remember that you password should be at least 6 characters long, should contain at least one non-alphabetic character, and should not be any word in the English language.

1.3. Getting help in Unix

The man command is useful to get more information about any command in Unix. For instance, to find out more about the cp command, you would type

man cp

The apropos command can help you find commands related to some keyword. For instance apropos copy would list all UNIX commands related to copying (including cp).

2. Editing

A number of editors are available in the UNIX environment for creating your programs. These include pico and vi, text-based editors that work when accessed through the PCs, and textedit, a windows-based editor that has full mouse capability but only works on the X-terminals.

Note that any C++ program file you create must end in .cc.

3. Compiling and running

The UNIX C++ compiler is called g++. To compile your program, type that name followed by the name of your program, as in:

g++ prog1.cc

If your program has syntax errors, they will be printed to the screen. If you have more than one screen of errors, you can pipe the output to the more command to see them one screen at a time:

g++ prog1.cc | more

If there are no syntax errors, the compiler will produce an executable file called a.out. To run the executable code, simply type in:

a.out

4. Printing

To print out a file (such as your program), use the following command:

lp -d p30xy filename

where
filename is the file you wish to print,
x is the last digit of the room you are in (either 1, 2, or 3),
y is either a, b, or c.

For example, to print prog1.c to printer a in room 301, you would type:

lp -d p301a prog1.c

5. Mailing your programs

Along with a hardcopy, you will be asked to submit an electronic copy of your programs to me by email. The pine program may be used to send programs to me (as well as to send mail in general). You can either use the control-R command to read a program file into your mail, or add the program file as an attachment. My address is john@cis.ysu.edu

You may also use the command:

mail <filename john@cis.ysu.edu

Where filename is the file you want to mail. Don't forget the < sign!