Compiling C Programs at USC

My roommate had his Assignment #1 for CompSci 101 (I skipped ahead to 102, in which we use C++). He asked about how to test it, so I decided to help. I considered various options for compilers. Microsoft Visual Studio, Borland, GCC? Finally I decided that the method most likely used by students at the University of Southern California is to use X-Win32 6.1.2 to connect to the Aludra student webserver, and use the gcc compiler there. So I fired up XWin (took a minute to find it) and opened emacs. Luckily, it allowed me to simply copy-and-paste his code into the emacs editor window. I simply called the file “a.c”, saved it, and compiled it with gcc.

gcc a.c

The program had a few errors. Mostly simple typos. I fixed them, and out popped a.out.

a.out

The program ran well, just some cosmetic problems to be fixed. Once those were solved, I was faced with the problem of getting this output back onto disk. I tried to copy-and-paste out of emacs. No luck. Apparently, it uses its own clipboard. I was thinking I could email the file to myself, when suddenly I realized I had a public_html and could easily place files for online public access. I copied the file to public_html

cp a.c public_html

and tried to access it. No go. Forgot permissions. On aludra, the default permissions settings don’t allow access by web users.

cd public_html
chmod 666 a.c

There we go. Worked great. I was going to just send him the web address, when I realized that I can now copy and paste from my web browser into notepad. So that’s what I did. I saved it back on my roommate’s USC flash drive, and it was done.

I think I would be a good roommate for someone who needs computer help. Ideally, that person can also do something for me. We could be a great team. I’m just happy to know I have something to offer.

Leave a Reply