Programming Examples in C

The following list links to programming examples for the OpenVMS operating system. My intention is to do an example for nearly every LIB$ and SYS$ routine available.

Note that on the pages that show the examples, the navigation menu is not displayed to give me a little room to display the code. Use the browser back button to return to this page or click on the link at the bottom of each page to return to this list.

If you know nothing about LIB$ and SYS$ routines, you should probably start looking at these from the beginning. Else feel free to just dive in anywhere. Later programs will assume that you have read earlier ones.

Most of this code is not commented extensively (unlike my production code, which tends to be obsessively commented). I do however try to give a brief description of a concept that is used extensively the first time it's used. One thing that deserves mention is error checking. I use a macro to do error checking, and have it included from a file, errchk.h. Don't forget to get this if you want to build any of the examples.

Most of the code builds with a simple

    $ cc filename
    $ link filename

If something special needs to be done, the code will have compile instructions included in comments. Also included in the comments will be warnings about privileges required and the possibility of shooting yourself in the foot by running the code. Read the license and disclaimer before running this code.

As an additional bonus, the code hyperlinks to the OpenVMS documentation for the particular system services or RTL routines called from the code.

I said at the start that I intend to do an example for nearly all routines. The routines that are left out usually fall into a fairly straightforward category that cause me to omit them. These categories are:

If you are searching for a routine that falls into one of these categories and you don't find it, and you desperately need an example, you can contact me and I'll see what I can do.

For you VAX users out there, a lot of the code is using an Alpha/IPF specific header that defines quadwords. The code will probably run with some minor modifications (such as defining quadword structures as a two longword array, and passing the address of the first array element to the function). If you find yourself totally stuck on a VAX, and the code does not have an #error directive in it indicating it's Alpha/IPF specific, you can contact me, and I'll attempt to un-stick you.

As usual, I would be very interested to hear comments or criticisms concerning this code.