Oh, THAT's what you mean! Load enough bytes to fill a window; (80*24 for now; until I GUI) then when you scroll down; unload the first row and load the second row?
That would be too slow if you're going to open and close the file for each read. Actually, forget what I said earlier. Loading 4K every time the cursor moves outside of the loaded section would be enough.
x - cursor (or visible space)
[_] - loaded data
[0] - not loaded data
[x___][0000]
[_x__][0000]
[__x_][0000]
[___x][0000]
[0000][x___]
Loading 4K every time the cursor moves outside of the loaded section would be enough.
I think I understand. I should load the 4KiB of the file the cursor is "on". So you're actually looking for a command line program? That simplifies things.
Funnily enough the max filename size is also 4KiB (4096 characters to be specific) according to stdio.h's FILENAME_MAX. I'm using my own version; same size, though.
Oh and for now I'm only going to have one file open at a time; but in the future I might implement a doubly-linked list so you can have more; probably 16 maximum (because that would still require <= 64KiB just to store the list of filenames, let alone the <= 4KiB for each file buffer, the size of the pointer to the file structure (FILE*), etc...).
Urgh! I can't get GTK installed. What should I use for the GUI??? Stupid GTK; I did everything I was meant to; set export GTK_CFLAGS="`pkg-config gtk+-2.0 --cflags`"; export GTK_LIBS="`pkg-config gtk+-2.0 --libs`"... What more does it want?
Ugh... I'll try some other library; I wanted to use GTK because it looks awesome (IMO) but whatever...