question

StevenYoung-5410 avatar image
0 Votes"
StevenYoung-5410 asked StevenYoung-5410 commented

BinaryReader.Read dont support long values?

I need to use BinaryReader.Read to read the file that more than 2GB (greater than the integer value range), the function parameters only support int32.

_BinaryReader.Read(_Buffer, 0, ChunkSize) 'ChunkSize value is 5GB (5,368,709,120), it's long value.

vs-general
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Since it doesn't support it, do it in smaller chunks.

0 Votes 0 ·

Did you manage to create the target buffer having such large size? The length of arrays is limited.


0 Votes 0 ·

1 Answer

SimpleSamples avatar image
0 Votes"
SimpleSamples answered StevenYoung-5410 commented

Can you use a Memory Mapped File? MemoryMappedFile Class says:

Memory-mapped files enable programmers to work with extremely large files

So that appears to be what Microsoft intends to be used for such large files.



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Sure, thank you.

0 Votes 0 ·