Binary IO
Justin Whear via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jul 17 13:53:32 PDT 2014
On Thu, 17 Jul 2014 20:35:24 +0000, seany wrote:
> Hello,
>
> What are the methods of unformatted binary IO in d? File.write seems to
> use formatted ASCII . I would like to write a binary file that I cna
> read in fortan. Similarly, I would like to write a file in Fortan,
> unformatted IO, and read it using D.
You have a few options:
* The old std.stream -- this module is due for replacement, hopefully
ASAP.
* Use File.rawRead/rawWrite. These are intended for arrays, though they
can be used to read single values.
* Work with chunks of ubyte data and use std.bitmanip's read and write
functions.
The last option is probably your best option for producing good future-
proof, idiomatic D code.
More information about the Digitalmars-d-learn
mailing list