School of Engineering and Applied Science
Department of Computer Science
CSci 49 -- Introduction to C Computing
http://www.seas.gwu.edu/~csci49/spring06
Prof. Michael B. Feldman
mfeldman@gwu.edu

Lab Exercise #1
for labs meeting Wednesday, Jan. 18, 2006

Completing Parts I-V is essential to getting started properly in this course.
Even if you miss the first lab session, or do not complete Parts I-V in that session,
you must complete the work as soon as possible.

This exercise will help you In this lab you'll be asked to type a series of commands. These are given in boldface fixed-width text. Everything must be typed exactly as given, including dots, spaces, etc.

Part I. Getting your SEASCF account set up before the lab meets for the first time.

The School of Engineering and Applied Science Computing Facility (SEASCF) manages the server you will use for this course, a Sun/Solaris Unix server called hobbes. So you will need a student account from SEASCF. You must apply in person, at the facility in Tompkins Hall, 4th floor. You must arrange for this computer account BEFORE your first laboratory meeting!

If you took SEAS 1 or another SEAS course that used SEASCF facilities, your accpount is probably still OK.

Part II. Getting ready to use your hobbes account for CSci 49.

  1. Go to a computer and use the "SSH client" program to log in to hobbes.seas.gwu.edu.

  2.  
  3. Once you're logged in, type the following to get your account set up:

  4.   . ~csci49/setup-49

    This must be typed in exactly as you see it, including the initial dot and the "tilde." If you have files in your file system from other courses, the setup script will leave those untouched. The setup process will, however, modify your .kshrc files to give you read-only access to the shared directory that contains the commands and C programs you will need for the course.
     

  5. Once the setup is done, log off, then log in again.

  6.  
  7. Copy the file survey.txt into your file system:

  8.   cp ~csci49/survey.txt .
     
  9. Bring the survey form into the vi editor:

  10.   vi survey.txt
     
  11. Use the editor to fill in the requested information on the survey form. Be sure to give the e-mail address you will really use to receive e-mail related to this course. This address will be added to an electronic mailing list, and it is a requirement of the course to read e-mail at that address regularly (every day or so).

  12.  
  13. Save the survey back in your file system.

  14.  
  15. Send the survey as an e-mail message to Prof. Feldman:

  16.   pine mfeldman@gwu.edu <survey.txt

    and also to your lab instructor. Your lab instructor will tell you his or her e-mail address. Please do NOT send this form using another mail system, and -- most important -- DO NOT SEND ATTACHMENTS!

    Within the next day or so, we will both acknowledge receipt by sending a "thank you" message back to you. You will then know that we can communicate with each other.

Part III. Printing Hard Copy in the Lab.

  1. Open a Netscape or Mozilla browser (NOT Internet Explorer) and type the following address in the location window:

  2. ftp://your-user-id@calvin.seas.gwu.edu
    (replace your-user-id with your SEASCF userid). When prompted, enter your SEASCF password.
     
  3. You'll see a list of the files in your top-level directory. Click survey.txt.

  4.  
  5. Use the Netscape Print command to print this file.
  6. Click on the folder my49.
NOTE: If you are working in a SEAS lab (in Tompkins Hall), you cannot use ftp. On the other hand, you can mount your hobbes file system on the PC, as the "H:" drive, and treat it just as if it were an extra PC disk. You will need to use the above instructions if you are working on your project on any computer that is not in Tompkins!

Part IV. Compiling and Running C Programs

  1. You must do all the work  for this course in your my49 directory. Move to your my49 directory

  2. cd my49
     
  3. Examine the contents of your directory

  4. ls -l
    Briefly describe what you see.

     

  5. All the programs from the textbook, and others we will provide, are in a read-only subdirectory called programs49. Copy these C files from the programs49 subdirectory to your own my49:

  6. cp programs49/fig02_01.c .
    cp programs49/fig02_04.c .
    cp programs49/fig02_05.c .

     
  7. Display the contents of fig02_04.c:

  8. cat fig02_04.c

  9. Examine the contents of your directory (use ls -l again); briefly describe what you see.

  10.  
  11. Compile the first of these four files.

  12. ccompile fig02_01.c
     
  13. Examine the contents of your directory again. What do you see this time?

  14.  
  15. In your browser window, reload, then click on the file fig02_01.txt. How does it differ from fig02_01.c?

  16.  
  17. Now execute (run) fig02_01.exe

  18. crun fig02_01.exe

    Briefly describe what happened.

     

     
  19. Now compile and run the other 2 C programs. Briefly describe the results.

  20.  

Part V. Working with listing files and error messages.

  1. Bring fig02_05.c into the editor.
  2. Introduce a syntax (grammar) error by deleting the semicolon at the end of the printf line. Save the file, then compile it. What happens?

  3.  

  4. In your browser window, load the listing file fig02_04.txt. Observe the error message; summarize what it says.

  5.  

     
  6. Now in the ssh window, bring fig02_05.c back into the editor. Now introduce a semantic error into line 8 by changing int to Int. Compile the program once again. What happens?

  7.  

     

  8. Examine the listing file again by reloading it into the browser window.

  9. For your future reference, briefly describe what you've learned in this lab today, and congratulate yourself for getting through this!
     

     


(end of lab)