jlaasonen / hexfile

Simple command-line tool to print a hex dump of a file
https://jlaasonen.me/software/hexfile
MIT License
5 stars 0 forks source link

fileIndex should be 8 digits #1

Closed ghost closed 3 years ago

ghost commented 3 years ago

Nice to see hexdump in FreeBASIC!!

I notice you use 6 hexadecimal digits for fileIndex which is just sufficient for 16MB file size! Print Hex(fileIndex,6);Space(tabWidth);hexBytes;Space(tabWidth);asciiBytes

In FAT32 system, normally we accommodate 8 hexadecimal digits for file offset, which is 4GB (2^32).

As stated in FreeBASIC documentation , GET command read a file position of longint (64-bit).

So I think it is best to at least change the Hex(fileIndex,6) to Hex(fileIndex,8).

Cheers!

jlaasonen commented 3 years ago

It is true that 8 digits would be best for a large file, but who would scroll through gigabytes of data? For small files, the extra zeroes just add clutter. It would be better to have offset digits dynamic and/or configurable.