std.file new functions/classes

Regan Heath regan at netwin.co.nz
Fri Mar 10 00:55:31 PST 2006


On Fri, 10 Mar 2006 07:56:36 +0000 (UTC), jicman  
<jicman_member at pathlink.com> wrote:
> Has anyone figured out how to use the DirEntry entries for std.file?

I believe DirEntry is currently only used with listdir, eg.

import std.file;
import std.stdio;

void main()
{
	bool showFile(DirEntry* e)
	{
		if (e.isdir()) return true;
		writefln("  ",e.name);
		return true;
	}
	
	bool showDir(DirEntry* e)
	{
		if (!e.isdir()) return true;
		writefln("  ",e.name);
		return true;
	}
	
	writefln("Files:");
	listdir(".",&showFile);
	writefln("");
	
	writefln("Directories:");
	listdir(".",&showDir);
	writefln("");
}

Regan



More information about the Digitalmars-d-learn mailing list