Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Binary read/write

Moderators: larsivi kris

Posted: 09/05/09 09:23:59

I can't seem to avoid deprecated files. What I want is some thing like this:

auto file=new File( "animation.fjc", File.ReadWriteCreate ); // or just 'write'
auto write=new File( file );
scope(exit) file.close

auto file=new File( "animation.fjc", File.ReadWriteCreate ); // or  just 'read'
auto read=new File("animation.fjc",READ);
scope(exit) file.close


Author Message

Posted: 09/05/09 11:47:56

You don't say what is deprecated. I can only guess that you're importing when you should be importing Or something like that.

Posted: 09/06/09 01:53:54

By the way, if you look at the 'current' version of the docs, all the deprecated I/O modules are gone.

Posted: 04/16/10 01:44:08

What's wrong with this?
I get:
tango.core.Exception.IOException: DataInput :: unexpected eof while reading

void main() {
	auto output = new DataOutput (new File ("test.dat", File.WriteCreate));
	output.int32   (1024); // this doesn't get on the file at all

	auto input = new DataInput (new File ("test.dat"));
	auto x = input.int32; // dies on this

Is this a good way to do binary read write? Maybe it's better for strings.

It's a long time ago, but thanks for your replies torhu.

Posted: 04/16/10 02:04:14

Try flushing the output before closing the file.

Posted: 04/16/10 09:03:47

That did the trick! Thanks torhu. :-)