Sean Heiss
Sean Heiss

Reputation: 780

How should I go about reading a large binary file

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.

Upvotes: 3

Views: 1184

Answers (1)

Otávio Décio
Otávio Décio

Reputation: 74290

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.

Upvotes: 6

Related Questions