D
D
Daniil Demidko2016-04-25 11:19:36
C++ / C#
Daniil Demidko, 2016-04-25 11:19:36

Navigating through a text file?

It is necessary to organize movement on a file.
For example, lines are read up to a certain point, and then you need to read a line higher from the same file.
And so many times.
What for? I am writing an interpreter for my little language.
Before that, I just read everything into std::vector, but storing large files in RAM seems kind of bad. What can be used here?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
res2001, 2016-04-25
@res2001

If you are afraid to read entire files, you can use the memory-mapped file mechanism.

R
RedHairOnMyHead, 2016-04-25
@ThePyzhov

I have nothing to say specifically on this issue, but I can advise you to read the Book of the Dragon .
When designing things like this, very helpful.

R
Rsa97, 2016-04-25
@Rsa97

It is better to convert the source into an intermediate code once (at least at the level of tokens) and work on it. There is no need to conduct a full analysis of the text every time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question