Implementing the lsl Utility Program (ls -l)

Overall Plan


Obtaining Documentation on UNIX: The man command


How to Use Documentation

  • The #includes listed near the top of the manual page should be added to your program if you want to use the functions described on the man page.
  • For example, in the manual page produced by man 3b directory, the following line appears:
    #include <sys/dir.h>
    This line should be added near the top of your program, exactly as shown.
  • The names and types shown for functions near the man page, do NOT show how to use the functions. Instead they show how the functions are declared in the relevant include file.
  • Example: In the file /usr/include/dir.h there is a declaration for the opendir function that looks like:
    DIR * opendir (char * fn);
  • This declaration says that opendir is a function that takes a character string and returns a pointer to a DIR structured value.
  • Some ways to use the opendir function in your program are:
    DIR *pDIR;
    pDIR = opendir(".");
    pDIR = opendir("MyDirName");
    pDIR = opendir("/tmp/somedir/somesubdir");

    What is a directory? (folder)


    The stat system call



    Overview of lsl.cpp Program


    Program and Scripted Output


    Return to Contents