Writing C Programs on a FreeBSD server
Connect to the server
- Start the PuTTY program.
- If your PC does not have PuTTY installed, you may download
it.
- Type "STU.ipv6.club.tw" as the Host Name, and click Open.
- 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.
- Type your username, press Enter.
- Type your password, press Enter.
Please notice that your password will not be shown on the screen
while you are typing.
- 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
- Type the name of an editor ("ee" or "vi"), and the filename you
want to edit.
- Exit the editor and save the program file.
Compile your source program to an executable file
- Invoke the GNU C++ compiler
- g++ ex2_00.cpp
- The default output file is "a.out". You may also specify the
output file name with an option:
- g++ ex2_00.cpp -o ex2_00.exe
- Run the executable file
- Simply type the filename to run it.
- Unix does not require an executable file to have a special
extension name (.EXE), so be careful when you name it.
- You may type the command "ls" to list all files under current
working directory.
- 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 ...
- Solution 1: Enable IPv6 on your PC.
- Solution 2: Use the TWAREN SSL/VPN service to access "site-local" servers.