How do I create a new file using phobos ?
Bill Baxter
dnewsgroup at billbaxter.com
Fri Sep 21 14:36:51 PDT 2007
Ray C Horn wrote:
> How do I create a new file using phobos ?
>
> More examples in the online docs would be useful.
You can do it several ways.
Theres std.c.stdio which has the classic C fopen/fclose API.
I usually use std.stream.BufferedFile
http://www.digitalmars.com/d/phobos/std_stream.html
Ex:
char[][] lines;
...
{
scope Stream file = new BufferedFile("sample.txt",FileMode.Out);
foreach(line; lines) {
file.writefln(line);
}
}
--bb
More information about the Digitalmars-d
mailing list