3

I have a large binary file (more than 500mb) that I want to read a part of and extract data from. I'm sure I shouldn't load the whole file into memory all at once, so how could I load only a part of it, using hex offsets?

I've never worked with this kind of thing before, so I have no idea where to start. All I want to read and write to the file is text.

Alex Chamberlain
  • 4,147
  • 2
  • 22
  • 49
Sean Heiss
  • 780
  • 2
  • 9
  • 25

1 Answers1

6

Use a Memory Mapped File. This will allow you to process the file as if it were in memory, but it only ever gets loaded into memory a page at a time.

Alex Chamberlain
  • 4,147
  • 2
  • 22
  • 49
Otávio Décio
  • 73,752
  • 17
  • 161
  • 228