@safe std.file.read

Steven Schveighoffer schveiguy at gmail.com
Mon Jan 6 15:52:01 UTC 2020


On 1/6/20 5:07 AM, WebFreak001 wrote:
> I was wondering, how are you supposed to use std.file : read in @safe 
> code when it returns a void[] but you want to get all bytes in the file?
> 
> Is void[] really the correct type it should be returning instead of 
> ubyte[] when it just reads a (binary) file to memory? Or should void[] 
> actually be castable to ubyte[] in @safe code?

I feel like this conversation has been had before. But I think it should 
be ubyte[]. Not sure why it's void[]. Perhaps for symmetry with write, 
which takes void[] (for good reason)?

-Steve


More information about the Digitalmars-d-learn mailing list