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,033
  • 2
  • 21
  • 48
Sean Heiss
  • 780
  • 2
  • 8
  • 24

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,033
  • 2
  • 21
  • 48
Otávio Décio
  • 72,200
  • 17
  • 159
  • 225