www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Output range for file?

reply Tofu Ninja <emmons0 purdue.edu> writes:
I tried looking for this in phobos but cant seem to find it which 
is really annoying. For my uses this works:

struct fileOutRange
{
	File f;
	void put(ubyte[] a)
	{
		f.rawWrite(a);
	}
}

But was just wondering if there was a real output range for files 
somewhere in phobos that I just cant seem to find.
Jan 24 2016
parent reply "H. S. Teoh via Digitalmars-d-learn" <digitalmars-d-learn puremagic.com> writes:
On Sun, Jan 24, 2016 at 12:38:22PM +0000, Tofu Ninja via Digitalmars-d-learn
wrote:
 I tried looking for this in phobos but cant seem to find it which is
 really annoying. For my uses this works:
What kind of data do you need to write to file? If it's textual data, use File.lockingTextWriter, which is an output range. If it's binary data, you'll probably have to roll your own; there's a Phobos PR right now that implements File.lockingBinaryWriter, but it's not quite ready for merging yet. T -- Real men don't take backups. They put their source on a public FTP-server and let the world mirror it. -- Linus Torvalds
Jan 24 2016
parent Tofu Ninja <emmons0 purdue.edu> writes:
On Sunday, 24 January 2016 at 15:08:33 UTC, H. S. Teoh wrote:
 On Sun, Jan 24, 2016 at 12:38:22PM +0000, Tofu Ninja via 
 Digitalmars-d-learn wrote:
 I tried looking for this in phobos but cant seem to find it 
 which is really annoying. For my uses this works:
What kind of data do you need to write to file? If it's textual data, use File.lockingTextWriter, which is an output range. If it's binary data, you'll probably have to roll your own; there's a Phobos PR right now that implements File.lockingBinaryWriter, but it's not quite ready for merging yet. T
I am writing out binary data, so I guess I will just keep using what I am using.
Jan 24 2016