The closedir procedure closes a directory variable (i.e. destroys the association between a directory variable and its directory). NOTE: Directories are also called folders.
The closedir procedure's only parameter is a reference to the directory variable to close.
//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.
Operating Systems: All Standard Pascal: No