Read X many bytes from File to address Y

tcak tcak at gmail.com
Wed Apr 7 12:57:12 UTC 2021


On Wednesday, 7 April 2021 at 12:50:01 UTC, Adam D. Ruppe wrote:
> On Wednesday, 7 April 2021 at 11:42:56 UTC, tcak wrote:
>> There is rawRead, but it takes an array as parameter, which 
>> causes a dirty looking code with cast etc!
>
> What did you wrote?
>
>
> file.rawRead(address[0 .. desiredLength])
>
>
> should do what you want.

Well, I have a struct, that is defined as a variable already. I 
want to read X bytes from the file (not Struct.sizeof bytes 
though), and read into the struct variable without any extra 
buffer.


More information about the Digitalmars-d-learn mailing list