randomIO, std.file, core.stdc.stdio

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 25 17:18:03 PDT 2016


On Monday, 25 July 2016 at 18:54:27 UTC, Charles Hixson wrote:
> Are there reasons why one would use rawRead and rawWrite rather 
> than fread and fwrite when doiing binary random io?  What are 
> the advantages?
>
> In particular, if one is reading and writing structs rather 
> than arrays or ranges, are there any advantages?

yes: keeping API consistent. ;-)

for example, my stream i/o modules works with anything that has 
`rawRead`/`rawWrite` methods, but don't bother to check for any 
other.

besides, `rawRead` is just looks cleaner, even with all 
`(&a)[0..1])` noise.

so, a question of style.


More information about the Digitalmars-d-learn mailing list