Description
The closedir procedure closes a directory variable (i.e. destroys the association between a directory variable and it's directory). NOTE: Directories are also called folders.
Parameter
The closedir procedure's only parameter is a reference to the directory variable to close.
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