Hex editors

Pages: 12
std::stringstream+std::hex, or sprintf().

Good point.

Load whatever is shown

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?
Last edited on
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___]
helios wrote:
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...).

Edit: like these:
Cursor at (0,0):
http://i49.tinypic.com/2wcl4lz.jpg
Cursor at (0, 3):
http://i46.tinypic.com/fax47k.jpg
?
Last edited on
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...

Last edited on
Qt. Build it complete from source for extra fun (C:\Qt\: 10.1 GiB).
I tried Qt before. There is no way I'm installing Qt. It took over three hours from ./configure until make install was finished.

I'll try WxWidgets... it's cross platform.

Edit: GTK+ is working now:

build.sh
1
2
3
4
5
6
GTK_CFLAGS=" `pkg-config gtk+-2.0 --cflags` "
GTK_LIBS=" `pkg-config gtk+-2.0 --libs` "
OPTIMIZE=" -O3 -Os -fexpensive-optimizations "
ERRORS_WARNINGS=" -Wall -Wextra "

gcc $GTK_CFLAGS $GTK_LIBS $OPTIMIZE $ERRORS_WARNINGS *.c

Don't ask why I split it into so many variables .That's just how I like to do it.

Haven't got a name yet; can you think of one? I was going to go for "0xVi" temporarily; albeit fairly bad.

I've never been good at coming up with names... :l

This is just irresistible:
http://library.gnome.org/devel/gtk/unstable/ch02.html

Oh and I've almost finished the GUI. I have to finish some stuff for the text box and then I can start on the real code :)
Last edited on
Topic archived. No new replies allowed.
Pages: 12