To use system calls and library functions in a C program we simply call the appropriate C function (Appendix ).
We have already met some system calls when dealing with low level IO - open(), creat(), read(), write() and close() are examples.
Examples of standard library functions we have met include the higher level I/O functions - fopen(), fprintf(), sprintf(), malloc() ...
All math functions such as sin(), cos(), sqrt() and random number generators - random(), seed(), lrand48(), drand48() etc. are standard math library functions.
NOTE: most standard library functions will use system calls within them.
For most system calls and library functions we have to include an appropriate header file. e.g. stdio.h, math.h
Information on nearly all system calls and library functions is available in manual pages. These are available on line: Simply type man function name.
e.g. ~man drand48
would give information about this random number generator.
All system calls and library functions have been listed in a previous handout.
We have already seen examples of string handling library functions. For the rest of this course we will study the application of a few more system and library functions.