Writing C Programs on a FreeBSD server

Connect to the server

  1. Start the PuTTY program.
  2. Type "STU.ipv6.club.tw" as the Host Name, and click Open.
  3. If this is the first time you connect to this server, it will pop up a security alert window as follow. Verify the fingerprint is 30:23:eb:66:56:b0:92:f1:65:17:a7:61:e0:2b:16:41 and click Yes to accept.
  4. Type your username, press Enter.
  5. Type your password, press Enter.
    Please notice that your password will not be shown on the screen while you are typing.
  6. You will see a welcome message, and the last line is "1 bsd92:~>". This is the prompt of the server, which implies that it is ready to get commands from you.

Edit a C program

  1. Type the name of an editor ("ee" or "vi"), and the filename you want to edit.
  2. Exit the editor and save the program file.

Compile your source program to an executable file

  1. Invoke the GNU C++ compiler
  2. Run the executable file
    1. Simply type the filename to run it.
      • a.out
      • ex2_00.exe
    2. Unix does not require an executable file to have a special extension name (.EXE), so be careful when you name it.
    3. You may type the command "ls" to list all files under current working directory.
    4. Try to type the command "ls -F". With the option "-F", you can see that executable files are designated with a tailing star (*).

If your location is outside the campus ...

  1. Solution 1: Enable IPv6 on your PC.
  2. Solution 2: Use the TWAREN SSL/VPN service to access "site-local" servers.