The opendir procedure

Description

The opendir procedure opens a directory variable (i.e. associates the directory variable with a directory). NOTE: Directories are also called folders.

Parameters

Example

   //Below is a simple program that lists all the files in the
   //current directory.
   program listfiles(output);
   var
      d : dir;
      filename : string;
   begin
      opendir(d, '.');  // Open current directory
      repeat
         readdir(d, filename);  // Get next file in directory
         if filename <> '' then
            writeln(filename);
      until filename = '';
      closedir(d) // Close directory
   end.

Portability

Operating Systems: All
Standard Pascal: No