new to D2.0 , invariant problem

Kagamin spam at here.lot
Thu Nov 20 04:16:03 PST 2008


MikeRJ Wrote:

> 	bool open(char[] fn, char[] mode="rb")
> 	{
> 		filename=fn.dup;
> 		file = fopen(toStringz(filename), toStringz(mode));
> 		if (!file) return false;
> 		return true;
> 	}

D1 and D2 compatible code:

        bool open(in char[] fn, in char[] mode="rb")
        {
                file = fopen(toStringz(fn), toStringz(mode));
                if (!file) return false;
                return true;
        }


More information about the Digitalmars-d-learn mailing list